Saltar al contenido principal
NeuralUIv1.14.3Nuevo
GitHub
Componente

Chip

Etiquetas compactas seleccionables y eliminables. Perfectas para filtros, tags y selección múltiple visual con soporte de señales.

TypeScript
import { NeuChipComponent } from '@neural-ui/core/chip';

Variantes

DefaultPrimarioÉxitoAdvertenciaError

Con botón de cierre

AngularTypeScriptRxJS

Filtros interactivos (señales)

AngularTypeScriptCSSRxJSSignalsOnPush

Activos: 2

Tamaños y deshabilitado

PequeñoMedianoDeshabilitado
TypeScript
import { NeuChipComponent } from '@neural-ui/core/chip';
import { signal } from '@angular/core';

@Component({
  imports: [NeuChipComponent],
  template: `
    <!-- Chips estáticos / Static chips -->
    <neu-chip>Angular</neu-chip>
    <neu-chip variant="primary" [selected]="true">TypeScript</neu-chip>

    <!-- Filtros interactivos / Interactive filters -->
    @for (tag of tags; track tag) {
      <neu-chip
        [selected]="selected().has(tag)"
        [removable]="true"
        (selectedChange)="toggle(tag)"
        (removed)="remove(tag)"
      >{{ tag }}</neu-chip>
    }
  `
})
export class MyComponent {
  readonly selected = signal(new Set(['Angular']));
  tags = ['Angular', 'TypeScript', 'RxJS'];

  toggle(tag: string) {
    this.selected.update(s => {
      const n = new Set(s);
      n.has(tag) ? n.delete(tag) : n.add(tag);
      return n;
    });
  }

  remove(tag: string) {
    this.selected.update(s => { const n = new Set(s); n.delete(tag); return n; });
  }
}