Component

Combobox

A searchable select. Feed it options or project items, pick one or many with chips, filter as you type, allow custom entries, and dress it in sizes, statuses, and states.

Single

Value: birch

import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { HbComboboxImports, type HbComboboxOption } from '@herbst/ui';

@Component({
  selector: 'hb-demo-combobox-single',
  imports: [HbComboboxImports],
  template: `
    <div class="flex flex-col gap-2">
      <div class="w-72 max-w-full">
        <hb-combobox
          hbPlaceholder="Search a leaf…"
          hbDropdown
          hbClearable
          hbFluid
          [hbOptions]="options"
          [hbValue]="value()"
          (hbValueChange)="value.set($event)"
        ></hb-combobox>
      </div>

      <p class="font-mono text-[12px] text-muted-foreground">Value: {{ value() ?? '—' }}</p>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoComboboxSingleComponent {
  protected readonly value = signal<unknown>('birch');

  protected readonly options: HbComboboxOption[] = [
    { value: 'oak', label: 'Oak' },
    { value: 'beech', label: 'Beech' },
    { value: 'maple', label: 'Maple' },
    { value: 'birch', label: 'Birch' },
    { value: 'chestnut', label: 'Chestnut' },
    { value: 'willow', label: 'Willow' },
  ];
}

Multiple & chips

BirchOak

Groups, labels & items

Filtering & custom values

Sizes, status & states

API reference

hb-combobox — value & data

PropertyDescriptionTypeDefault
[(hbValue)] Selected value, or an array when hbMultiple is set. unknown null
[hbOptions] Options as data: { value, label, disabled? }[]. Alternative to projected items. HbComboboxOption[] []
[hbMultiple] Allow selecting several values as chips. boolean false
[hbCompareWith] Equality function used to match values. (a, b) => boolean a === b
[hbSelectionLimit] / [hbMaxChips] Max selectable values, and how many chips show before a “+N” pill. number 0 / 2
[hbUnique] Prevent duplicate values in multiple mode. boolean true

hb-combobox — search & behaviour

PropertyDescriptionTypeDefault
[hbPlaceholder] Placeholder of the search input. string 'Search…'
[hbFilterMatchMode] How the typed query matches option labels. 'contains' | 'startsWith' | 'equals' 'contains'
[hbAllowCustom] Let the user commit a value that is not in the list. boolean false
[hbForceSelection] Clear the input unless a real option is chosen. boolean false
[hbMinLength] / [hbDebounce] Minimum characters before filtering, and debounce in ms. number 0 / 0
[hbDropdown] / [hbOpenOnFocus] / [hbAutoHighlight] Show a caret toggle, open on focus, and pre-highlight the first match. boolean false / true / true
[hbLoading] / [hbLoadingText] / [hbEmptyMessage] Loading state and its text, plus the no-results message. boolean / string false / 'Loading…' / 'No results.'
[hbVirtualScroll] + item/height Virtualise long lists (hbVirtualItemSize, hbVirtualHeight). boolean / number false / 36 / 280

hb-combobox — appearance, state & events

PropertyDescriptionTypeDefault
[hbSize] Control height and text scale. 'xs' | 'sm' | 'md' | 'lg' | 'xl' 'md'
[hbStatus] Validation colour of the control. 'default' | 'success' | 'warning' | 'error' 'default'
[hbFluid] / [hbBorderless] / [hbRing] Full width, remove the border, or toggle the focus ring. boolean false / false / true
[hbClearable] Show a button to clear the selection. boolean false
[hbDisabled] / [hbReadonly] / [hbInvalid] / [hbRequired] Standard form control states. boolean false
(hbChange) / (hbOpenChange) / (hbSearch) Emits on value change, panel open/close, and search text change. unknown / boolean / string

Content parts

PropertyDescriptionTypeDefault
hb-combobox-item [hbValue] [hbLabel] [hbDisabled] A projected option; hbLabel feeds the filter. slot
hb-combobox-group / hb-combobox-label / hb-combobox-separator Group items under a label, with dividers between groups. slot