Multi-select
Multi-select
Component demo
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}onIcChange={(event)=>console.log(event.detail.value)}onIcOptionSelect={(event)=>console.log(event.detail.value)}onIcOptionDeselect={(event)=>console.log(event.detail.value)}multiple/>
Select with multi details
Props
All components also accept native properties supported by the DOM, such asclassName
and
style
.
|
|
|
---|---|---|
|
The label for the select. |
|
|
**[DEPRECATED]** This prop should not be used anymore. |
|
|
The amount of time, in milliseconds, to wait to trigger the |
|
|
If |
|
|
If |
|
|
The text displayed when there are no options in the option list. |
|
|
The <form> element to associate the select with. |
|
|
The URL that processes the information submitted by the select. It overrides the action attribute of the select's form owner. Does nothing if there is no form owner. This prop should only be used with searchable select and will only be applied if searchable is true. |
|
|
The way the submitted form data is encoded. This prop should only be used with searchable select and will only be applied if searchable is true. |
|
|
The HTTP method used to submit the form. This prop should only be used with searchable select and will only be applied if searchable is true. |
|
|
If |
|
|
The place to display the response from submitting the form. It overrides the target attribute of the select's form owner. This prop should only be used with searchable select and will only be applied if searchable is true. |
|
|
If |
|
|
The helper text that will be displayed for additional field guidance. |
|
|
If |
|
|
If |
|
|
If |
|
|
If |
|
|
The message displayed when external loading times out. |
|
|
The message displayed whilst the options are being loaded externally. |
|
|
If |
|
|
The name of the control, which is submitted with the form data. |
|
|
The possible selection options. |
|
|
The placeholder value to be displayed. |
|
|
If |
|
|
If |
|
|
Whether the search string of the searchable select should match the start of or anywhere in the options. Only applies to built in filtering. |
|
|
If |
|
|
If |
|
|
If |
|
|
The size of the select. |
|
|
**[DEPRECATED]** This prop should not be used anymore. Set prop |
|
|
If using external filtering, set a timeout for when loading takes too long. |
|
|
The validation status - e.g. 'error' | 'warning' | 'success'. |
|
|
The text to display as the validation message. |
|
|
The value of the select, reflected by the value of the currently selected option. For the searchable variant, the value is also reflected by the user input. For the multi-select variant, the value must be an array of option values. |
|
The label for the select. |
**[DEPRECATED]** This prop should not be used anymore. |
The amount of time, in milliseconds, to wait to trigger the |
If |
If |
The text displayed when there are no options in the option list. |
The <form> element to associate the select with. |
The URL that processes the information submitted by the select. It overrides the action attribute of the select's form owner. Does nothing if there is no form owner. This prop should only be used with searchable select and will only be applied if searchable is true. |
The way the submitted form data is encoded. This prop should only be used with searchable select and will only be applied if searchable is true. |
The HTTP method used to submit the form. This prop should only be used with searchable select and will only be applied if searchable is true. |
If |
The place to display the response from submitting the form. It overrides the target attribute of the select's form owner. This prop should only be used with searchable select and will only be applied if searchable is true. |
If |
The helper text that will be displayed for additional field guidance. |
If |
If |
If |
If |
The message displayed when external loading times out. |
The message displayed whilst the options are being loaded externally. |
If |
The name of the control, which is submitted with the form data. |
The possible selection options. |
The placeholder value to be displayed. |
If |
If |
Whether the search string of the searchable select should match the start of or anywhere in the options. Only applies to built in filtering. |
If |
If |
If |
The size of the select. |
**[DEPRECATED]** This prop should not be used anymore. Set prop |
If using external filtering, set a timeout for when loading takes too long. |
The validation status - e.g. 'error' | 'warning' | 'success'. |
The text to display as the validation message. |
The value of the select, reflected by the value of the currently selected option. For the searchable variant, the value is also reflected by the user input. For the multi-select variant, the value must be an array of option values. |
CSS Custom Properties
|
|
---|---|
|
|
|
|
|
|
|
|
|
Events
All components also accept native events supported by the DOM, such as
onClick
and
onKeyDown
.
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Methods
|
|
|
---|---|---|
|
|
|
|
Variants
Default value
Show options as pre-selected by setting thevalue
prop to an array containing the values of these options.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"value={["Ame","Fil","Moc"]}options={options}onIcChange={(event)=>console.log(event.detail.value)}onIcOptionSelect={(event)=>console.log(event.detail.value)}onIcOptionDeselect={(event)=>console.log(event.detail.value)}multiple/>
With clear button
Display a clear button by using theshowClearButton
prop.
This will appear when the user has selected some options and allow them to easily clear their selection.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"show-clear-button="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}onIcChange={(event)=>console.log(event.detail.value)}onIcOptionSelect={(event)=>console.log(event.detail.value)}onIcOptionDeselect={(event)=>console.log(event.detail.value)}multipleshowClearButton/>
With descriptions
Display extra information about the options by providing a description using thedescription
property for each option.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}onIcChange={(event)=>console.log(event.detail.value)}onIcOptionSelect={(event)=>console.log(event.detail.value)}onIcOptionDeselect={(event)=>console.log(event.detail.value)}multiple/>
Helper text
Display helper text to provide additional information by using thehelperText
prop.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"helper-text="Select some options from the list"multiple="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"helperText="Select some options from the list"options={options}onIcChange={(event)=>console.log(event.detail.value)}onIcOptionSelect={(event)=>console.log(event.detail.value)}onIcOptionDeselect={(event)=>console.log(event.detail.value)}multiple/>
Sizes
Set the size of the multi-select by using thesize
prop. This prop takes the valuessmall
,default
orlarge
.
Depending on the chosen size, the prop will apply styling to increase or decrease the amount of spacing within the component.
Thedefault
variant is seen in the first
Interactive example
<ic-select-with-multiid="select-default-small"label="What are your favourite types of coffee?"multiple="true"size="small"></ic-select-with-multi><ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"></ic-select-with-multi><ic-select-with-multiid="select-default-large"label="What are your favourite types of coffee?"multiple="true"size="large"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiplesize="small"/><IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiple/><IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiplesize="large"/>
Disabled
Disable the multi-select and prevent user interaction by using thedisabled
prop.
Interactive example
<ic-select-with-multilabel="What are your favourite types of coffee?"multiple="true"disabled="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"multipledisabled/>
Disabled options
Disable certain options by setting thedisabled
property totrue
for each option.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}onIcChange={(event)=>console.log(event.detail.value)}onIcOptionSelect={(event)=>console.log(event.detail.value)}onIcOptionDeselect={(event)=>console.log(event.detail.value)}multiple/>
Hide label
Hide the visible label for the multi-select by using thehideLabel
prop.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"hide-label="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiplehideLabel/>
Required
Inform the user that the multi-select is a required field by using therequired
prop.
This will display an asterisk next to the label and apply thearia-required
attribute.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"required="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiplerequired/>
Read-only
Make the multi-select read-only by using thereadonly
prop.
Use thevalue
prop to set which options are selected and will be displayed when it is read-only.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"readonly="true"></ic-select-with-multi>
<IcSelectWithMultivalue={["Cap","Fla","Moc"]}label="What are your favourite types of coffee?"options={options}multiplereadonly/>
Groups
Display options in groups by passing an array of child options to thechildren
property of a parent option.
The parent option will be rendered as the title of the group.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiple/>
Recommended
Display certain options at the top of the option list by setting therecommended
property totrue
on each option.
This will allow for quick access to these options.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiple/>
Validation
Display a validation status and message by using thevalidation-status
andvalidation-message
props.
Thevalidation-status
prop takes the valuessuccess
,warning
orerror
.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"validation-status="success"validation-text="Coffee available"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multiplevalidation-status="success"validation-text="Coffee available"/>
Loading with error
Display the loading state by using theloading
prop.
The multi-select will show a loading error after the amount of time specified using thetimeout
prop has elapsed.
Interactive example
<ic-select-with-multiid="select-default"label="What are your favourite types of coffee?"multiple="true"loading="true"timeout="1000"></ic-select-with-multi>
<IcSelectWithMultilabel="What are your favourite types of coffee?"options={options}multipleloadingtimeout={1000}/>