View as Markdown

API reference: @salmonui/dropdowns/combobox

ComboboxColumninterface

import type { ComboboxColumn } from '@salmonui/dropdowns/combobox';
interface ComboboxColumn<Item> {
    readonly field: string;
    readonly header?: string;
    readonly width?: number | `${number}%`;
    readonly align?: 'start' | 'end' | 'center';
    readonly format?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((value: unknown, item: Item) => string);
    readonly renderCell?: (props: {
        readonly item: Item;
        readonly value: unknown;
        readonly text: string;
    }) => ReactNode;
    readonly renderHeader?: (props: {
        readonly column: ComboboxColumn<Item>;
    }) => ReactNode;
    readonly displayAsCheckbox?: boolean;
    readonly cellProps?: {
        readonly className?: string | undefined;
        readonly style?: CSSProperties | undefined;
        readonly [data: `data-${string}`]: string | number | boolean | undefined;
    } | ((item: Item) => {
        readonly className?: string | undefined;
        readonly style?: CSSProperties | undefined;
    } | undefined);
    readonly sortable?: boolean;
}
ComboboxColumn members (10)
NameSignatureDescription
fieldreadonly field: string;

Item field shown in the column; also the sort key and searchFields name.

headeroptionalreadonly header?: string;
widthoptionalreadonly width?: number | `${number}%`;

Pixels or a percentage string ('40%').

alignoptionalreadonly align?: 'start' | 'end' | 'center';
formatoptionalreadonly format?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((value: unknown, item: Item) => string);

Intl options (numbers, dates) or a formatter.

renderCelloptionalreadonly renderCell?: (props: { readonly item: Item; readonly value: unknown; readonly text: string; }) => ReactNode;
renderHeaderoptionalreadonly renderHeader?: (props: { readonly column: ComboboxColumn<Item>; }) => ReactNode;
displayAsCheckboxoptionalreadonly displayAsCheckbox?: boolean;

Shows a boolean value as a checkbox mark.

cellPropsoptionalreadonly cellProps?: { readonly className?: string | undefined; readonly style?: CSSProperties | undefined; readonly [data: `data-${string}`]: string | number | boolean | undefined; } | ((item: Item) => { readonly className?: string | undefined; readonly style?: CSSProperties | undefined; } | undefined);

Extra props for every cell of the column.

sortableoptionalreadonly sortable?: boolean;

Header click sorting for this column. Default true.