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;
}
| Name | Signature | Description |
|---|---|---|
field | readonly field: string; | Item field shown in the column; also the sort key and |
headeroptional | readonly header?: string; | |
widthoptional | readonly width?: number | `${number}%`; | Pixels or a percentage string ( |
alignoptional | readonly align?: 'start' | 'end' | 'center'; | |
formatoptional | readonly format?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((value: unknown, item: Item) => string); |
|
renderCelloptional | readonly renderCell?: (props: {
readonly item: Item;
readonly value: unknown;
readonly text: string;
}) => ReactNode; | |
renderHeaderoptional | readonly renderHeader?: (props: {
readonly column: ComboboxColumn<Item>;
}) => ReactNode; | |
displayAsCheckboxoptional | readonly displayAsCheckbox?: boolean; | Shows a boolean value as a checkbox mark. |
cellPropsoptional | 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); | Extra props for every cell of the column. |
sortableoptional | readonly sortable?: boolean; | Header click sorting for this column. Default |