Select
Form component used for selecting a value from a large list of options, with autocomplete and pagination support
Basic Example
The most basic use case for a select component is to have all the select options predefined using the options property. This component allows you to easily choose from a set of values and display a computed option label of your choice.
Here are some considerations to be made:
- Each option must be an Object
{} - Each option must have a unique identifier field, such as
id - The
selectedvalue will be the option itself
Disabled State
Setting the disabled property will disable all interactions with the select component.
You can also disable individual options by setting the option’s disabled field to true.
Readonly State
Setting the readonly property will disable all interactions with the select component, except being able to focus the select.
Clearable Variant
If you need to be able to quickly clear the value of an select, you can add the clearable property to the select component.
Prefix and Suffix
Inkline allows you to easily add a prefix or suffix to your select. Using prefixes and suffixes you can, for example, indicate your select type using an icon or text.
Prepend and Append
You can add additional content such as select fields, buttons or plain text, to either side of the select by using the prepend and append slots.
Colors
You can use the color property to set a light or dark color for your select.
Sizes
You’re able to use the size modifier to control the size of your select, using one of the available sizes: sm, md, and lg. The default size is set to md.
Header and Footer
You can provide a custom header and footer for the select menu using the header and footer slots.
Markup Example
The old way to write the select input is still viable, although it doesn’t support the more advanced features that the Inkline 3 Select has to offer.
Configuration
Props
Use props to modify the component’s design and behavior.
- Property
animationDurationTypeNumberDefault300Description The duration of the hide and show animation - Property
autocompleteTypeBooleanDefaultfalseDescription Enable autocomplete functionality - Property
arrowTypeBooleanDefaulttrueDescription Displays an arrow on the dropdown pointing to the trigger element - Property
colorType'light' | 'dark'Default'light'Description The color variant of the select - Property
clearableTypeBooleanDefaultfalseDescription Display the select as clearable - Property
disabledTypeBooleanDefaultfalseDescription The disabled state of the select - Property
idFieldTypeStringDefault'id'Description The field to be used for identifying the options - Property
keydownTriggerTypestring[]Default'up, down, enter, space, tab, esc'Description The keydown events bound to the trigger element - Property
keydownItemTypestring[]Default'up, down, enter, space, tab, esc'Description The keydown events bound to the select option elements - Property
labelTypeString | FunctionDefault'label'Description Used to extract the label from the select option and select value - Property
loadingTypeBooleanDefaultfalseDescription The loading state of the select - Property
modelValueTypeObject | String | NumberDefault'null'Description Used to set the field value - Property
minLengthTypeNumberDefault0Description The minimum input length to open the select dropdown at - Property
nameTypeStringDefaultuid()Description The unique identifier of the select - Property
optionsTypeArrayDefault''Description The options to be displayed in the select component - Property
placeholderTypeStringDefault''Description The placeholder of the select input - Property
offsetTypeNumberDefault6Description The offset of the dropdown relative to the trigger element - Property
placementType'top' | top-start | top-end | 'bottom' | bottom-start | bottom-end | 'left' | left-start | left-end | 'right' | right-start | right-endDefaultfalseDescription The placement of the dropdown - Property
popperOptionsTypeObjectDefault''Description Used to override the popper.js options used for creating the dropdown - Property
readonlyTypeBooleanDefaultfalseDescription The readonly state of the select - Property
scrollToleranceTypeNumberDefault160Description The number of pixels until scroll end before loading the next page - Property
selectFirstOptionOnEnterTypeBooleanDefaulttrueDescription Selects the first option when pressing enter - Property
sizeType'sm' | 'md' | 'lg'Default'md'Description The size variant of the select - Property
tabindexTypeNumber | StringDefault1Description The tabindex of the select - Property
typeTypeStringDefault'text'Description The type of the select - Property
totalTypeNumberDefault'undefined'Description The total number of options, used for infinite scrolling
Slots
Use slots to insert custom content into well-defined component locations.
- Property
prefixDescription Slot for the select prefix content - Property
suffixDescription Slot for the select suffix content - Property
prependDescription Slot for the select prepend content - Property
appendDescription Slot for the select append content - Property
clearableDescription Slot for the clearable button
Events
Use events to react to something happening inside the component.
- Property
update:modelValueDescription Event emitted for setting the modelValue - Property
searchDescription Event emitted when input value changes - Property
paginationDescription Event emitted when the next page needs to be loaded
CSS Variables
Read more about configuring Inkline’s Design System variables to update the look and feel of the component.
- Property
----backgroundValuecolor('white')Description The background of the select component - Property
----border-top-colorValuecolor('light-55')Description The border top color of the select component - Property
----border-right-colorValuecolor('light-55')Description The border right color of the select component - Property
----border-bottom-colorValuecolor('light-55')Description The border bottom color of the select component - Property
----border-left-colorValuecolor('light-55')Description The border left color of the select component - Property
----border-colorValuevar(----border-top-color) var(----border-right-color) var(----border-bottom-color) var(----border-left-color)Description The border color of the select component - Property
----border-styleValuevar(--border-style)Description The border style of the select component - Property
----border-top-widthValuevar(--border-top-width)Description The border top width of the select component - Property
----border-right-widthValuevar(--border-right-width)Description The border right width of the select component - Property
----border-bottom-widthValuevar(--border-bottom-width)Description The border bottom width of the select component - Property
----border-left-widthValuevar(--border-left-width)Description The border left width of the select component - Property
----border-widthValuevar(----border-top-width) var(----border-right-width) var(----border-bottom-width) var(----border-left-width)Description The border width of the select component - Property
----border-top-left-radiusValuevar(--border-top-left-radius)Description The border top left radius of the select component - Property
----border-top-right-radiusValuevar(--border-top-right-radius)Description The border top right radius of the select component - Property
----border-bottom-right-radiusValuevar(--border-bottom-right-radius)Description The border bottom right radius of the select component - Property
----border-bottom-left-radiusValuevar(--border-bottom-left-radius)Description The border bottom left radius of the select component - Property
----border-radiusValuevar(----border-top-left-radius) var(----border-top-right-radius) var(----border-bottom-right-radius) var(----border-bottom-left-radius)Description The border radius of the select component - Property
----box-shadow-offset-xValuevar(--box-shadow-offset-x)Description The box shadow horizontal offset of the select component - Property
----box-shadow-offset-yValuevar(--box-shadow-offset-y)Description The box shadow vertical offset of the select component - Property
----box-shadow-blur-radiusValuevar(--box-shadow-blur-radius)Description The box shadow blur radius of the select component - Property
----box-shadow-spread-radiusValuevar(--box-shadow-spread-radius)Description The box shadow spread radius of the select component - Property
----box-shadow-colorValuevar(--box-shadow-color)Description The box shadow spread radius of the select component - Property
----box-shadowValuevar(----box-shadow-offset-x) var(----box-shadow-offset-y) var(----box-shadow-blur-radius) var(----box-shadow-spread-radius) var(----box-shadow-color)Description The box shadow of the select component - Property
----colorValuecontrast-color($color-white)Description The color of the select component item - Property
----font-sizeValuefont-size()Description The font size of the select component - Property
----font-weightValuefont-weight('normal')Description The font weight of the select component - Property
----line-heightValuevar(--line-height)Description The line height of the select component - Property
----margin-topValuecalc(var(--margin-top) / 2)Description The margin top of the select component - Property
----margin-rightValuecalc(var(--margin-right) / 2)Description The margin right of the select component - Property
----margin-bottomValuecalc(var(--margin-bottom) / 2)Description The margin bottom of the select component - Property
----margin-leftValuecalc(var(--margin-left) / 2)Description The margin left of the select component - Property
----marginValuevar(----margin-top) var(----margin-right) var(----margin-bottom) var(----margin-left)Description The margin of the select component - Property
----padding-topValuevar(--padding-top)Description The padding top of the select component - Property
----padding-rightValuevar(--padding-right)Description The padding right of the select component - Property
----padding-bottomValuevar(--padding-bottom)Description The padding bottom of the select component - Property
----padding-leftValuevar(--padding-left)Description The padding left of the select component - Property
----paddingValuevar(----padding-top) var(----padding-right) var(----padding-bottom) var(----padding-left)Description The padding of the select component - Property
----min-widthValue240pxDescription The minimum width of the select component - Property
----max-widthValue90vwDescription The maximum width of the select component - Property
----max-heightValue300pxDescription The maximum height of the select component body - Property
----z-indexValue2000Description The z-index of the select component - Property
----option--backgroundValuevar(----background)Description The background of the select component option - Property
----option--background--hoverValuecolor('light-25')Description The background of the select component option when hovered or focused - Property
----option--background--activeValuevar(----option-background--active)Description The background of the select component option when active - Property
----option--background--disabledValuetransparentDescription The background of the select component option when disabled - Property
----option--border-top-left-radiusValue0Description The border top left radius of the modal component - Property
----option--border-top-right-radiusValue0Description The border top right radius of the modal component - Property
----option--border-bottom-right-radiusValue0Description The border bottom right radius of the modal component - Property
----option--border-bottom-left-radiusValue0Description The border bottom left radius of the modal component - Property
----option--border-radiusValuevar(----option--border-top-left-radius) var(----option--border-top-right-radius) var(----option--border-bottom-right-radius) var(----option--border-bottom-left-radius)Description The border radius of the modal component - Property
----option--colorValuevar(----color)Description The color of the select component option - Property
----option--color--hoverValuevar(----option--color)Description The color of the select component option when hovered or focused - Property
----option--color--activeValuevar(----option--color)Description The color of the select component option when active - Property
----option--color--disabledValuecolor('light-65')Description The color of the select component option when disabled - Property
----option--padding-topValuecalc(var(----padding-top) / 2)Description The padding top of the select component option - Property
----option--padding-rightValuevar(----padding-right)Description The padding right of the select component option - Property
----option--padding-bottomValuecalc(var(----padding-bottom) / 2)Description The padding bottom of the select component option - Property
----option--padding-leftValuevar(----padding-left)Description The padding left of the select component option - Property
----option--paddingValuevar(----option--padding-top) var(----option--padding-right) var(----option--padding-bottom) var(----option--padding-left)Description The padding of the select component option - Property
----divider--marginValuespacing('1/2')Description The margin of the select component divider - Property
----header--backgroundValuecolor('gray-05')Description The background of the select component header - Property
----header--border-colorValuevar(----border-color)Description The border color of the select component header - Property
----header--border-styleValuevar(----border-style)Description The border style of the select component header - Property
----header--border-top-widthValuevar(----border-top-width)Description The border top width of the select component header - Property
----header--border-right-widthValuevar(----border-right-width)Description The border right width of the select component header - Property
----header--border-bottom-widthValue0Description The border bottom width of the select component header - Property
----header--border-left-widthValuevar(----border-left-width)Description The border left width of the select component header - Property
----header--border-widthValuevar(----header--border-top-width) var(----header--border-right-width) var(----header--border-bottom-width) var(----header--border-left-width)Description The border width of the select component header - Property
----header--colorValuevar(----color)Description The color of the select component header - Property
----header--padding-topValuecalc(var(----padding-top) * 3 / 4)Description The padding top of the select component header - Property
----header--padding-rightValuevar(----padding-right)Description The padding right of the select component header - Property
----header--padding-bottomValuecalc(var(----padding-bottom) * 3 / 4)Description The padding bottom of the select component header - Property
----header--padding-leftValuevar(----padding-left)Description The padding left of the select component header - Property
----header--paddingValuevar(----header--padding-top) var(----header--padding-right) var(----header--padding-bottom) var(----header--padding-left)Description The padding of the select component header - Property
----body--backgroundValuevar(----background)Description The background of the select component body - Property
----body--border-colorValuevar(----border-color)Description The border color of the select component body - Property
----body--border-styleValuevar(----border-style)Description The border style of the select component body - Property
----body--border-top-widthValuevar(----border-top-width)Description The border top width of the select component body - Property
----body--border-right-widthValuevar(----border-right-width)Description The border right width of the select component body - Property
----body--border-bottom-widthValuevar(----border-bottom-width)Description The border bottom width of the select component body - Property
----body--border-left-widthValuevar(----border-left-width)Description The border left width of the select component body - Property
----body--border-widthValuevar(----body--border-top-width) var(----body--border-right-width) var(----body--border-bottom-width) var(----body--border-left-width)Description The border width of the select component body - Property
----body--colorValuevar(----color)Description The color of the select component body - Property
----body--padding-topValuevar(----padding-top)Description The padding top of the select component body - Property
----body--padding-rightValue0Description The padding right of the select component body - Property
----body--padding-bottomValuevar(----padding-bottom)Description The padding bottom of the select component body - Property
----body--padding-leftValue0Description The padding left of the select component body - Property
----body--paddingValuevar(----body--padding-top) var(----body--padding-right) var(----body--padding-bottom) var(----body--padding-left)Description The padding of the select component body - Property
----footer--backgroundValuecolor('gray-05')Description The background of the select component footer - Property
----footer--border-colorValuevar(----border-color)Description The border color of the select component footer - Property
----footer--border-styleValuevar(----border-style)Description The border style of the select component footer - Property
----footer--border-top-widthValuevar(----border-top-width)Description The border top width of the select component footer - Property
----footer--border-right-widthValuevar(----border-right-width)Description The border right width of the select component footer - Property
----footer--border-bottom-widthValuevar(----border-bottom-width)Description The border bottom width of the select component footer - Property
----footer--border-left-widthValuevar(----border-left-width)Description The border left width of the select component footer - Property
----footer--border-widthValuevar(----footer--border-top-width) var(----footer--border-right-width) var(----footer--border-bottom-width) var(----footer--border-left-width)Description The border width of the select component footer - Property
----footer--colorValuevar(----color)Description The color of the select component footer - Property
----footer--padding-topValuecalc(var(----padding-top) * 3 / 4)Description The padding top of the select component footer - Property
----footer--padding-rightValuevar(----padding-right)Description The padding right of the select component footer - Property
----footer--padding-bottomValuecalc(var(----padding-bottom) * 3 / 4)Description The padding bottom of the select component footer - Property
----footer--padding-leftValuevar(----padding-left)Description The padding left of the select component footer - Property
----footer--paddingValuevar(----footer--padding-top) var(----footer--padding-right) var(----footer--padding-bottom) var(----footer--padding-left)Description The padding of the select component footer