gradum-kit - v0.1.0
    Preparing search index...

    Type Alias GradumSelectProperties<ValueType, SecondaryValueType, EntryType>

    Properties to initialize a GradumSelect. Entries can be supplied directly through entries, or generated from values using createEntry.

    type GradumSelectProperties<
        ValueType = string,
        SecondaryValueType = string,
        EntryType extends object = HTMLElement,
    > = {
        entriesClasses?: string | string[];
        selectedEntriesClasses?: string | string[];
        entries?: HTMLCollection | NodeList | EntryType[];
        values?: (ValueType | EntryType)[];
        selectedValues?: ValueType[];
        getValue?: (entry: EntryType) => ValueType;
        getSecondaryValue?: (entry: EntryType) => SecondaryValueType;
        createEntry?: (value: ValueType) => EntryType;
        onEntryAdded?: (entry: EntryType, index: number) => void;
        onEntryRemoved?: (entry: EntryType) => void;
        onEntryClicked?: (entry: EntryType, e: Event) => void;
        multiSelection?: boolean;
        forceSelection?: boolean;
        inputName?: string;
        parent?: Element;
        onSelect?: (b: boolean, entry: EntryType, index: number) => void;
        onEnabled?: (b: boolean, entry: EntryType, index: number) => void;
    }

    Type Parameters

    • ValueType = string

      The type of the value each entry carries.

    • SecondaryValueType = string

      The type of the secondary value each entry carries.

    • EntryType extends object = HTMLElement

      The type of the entries themselves.

    Index
    entriesClasses?: string | string[]

    CSS class(es) added to every entry.

    selectedEntriesClasses?: string | string[]

    CSS class(es) added to entries while selected.

    The entries to populate the select with.

    values?: (ValueType | EntryType)[]

    Values to build entries from, using createEntry.

    selectedValues?: ValueType[]

    Values selected initially.

    getValue?: (entry: EntryType) => ValueType

    Reads the value carried by an entry.

    getSecondaryValue?: (entry: EntryType) => SecondaryValueType

    Reads an entry's secondary value.

    createEntry?: (value: ValueType) => EntryType

    Builds an entry for a value in values.

    onEntryAdded?: (entry: EntryType, index: number) => void

    Called when an entry is added.

    onEntryRemoved?: (entry: EntryType) => void

    Called when an entry is removed.

    onEntryClicked?: (entry: EntryType, e: Event) => void

    Called when an entry is clicked.

    multiSelection?: boolean

    Whether more than one entry can be selected at a time.

    forceSelection?: boolean

    Whether at least one entry must stay selected, preventing the last selected entry from being deselected.

    inputName?: string

    Name given to the underlying form inputs, to submit the selection with a form.

    parent?: Element

    Element the entries are appended to.

    onSelect?: (b: boolean, entry: EntryType, index: number) => void

    Called when an entry's selected state changes, with the new state.

    onEnabled?: (b: boolean, entry: EntryType, index: number) => void

    Called when an entry's enabled state changes, with the new state.