Skip to main content

Select

Allow users to select an option from a long list. This component uses the base structure of the Input component.

<Select id="select" label="Select">
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>`

Usage​

To follow user-centred design and GDPR best practices, we should only ask users for information we need. In that respect, all form fields of the Pallote component library are by default required.

For the CSS library, you do not need to add the required property to the form fields, it is added automatically with the javascript import.

Props​

isFocused​

Focus on a input on page load.

<Select id="focused" label="IsFocused" isFocused>
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>

Error​

Notify users that the field has an error.

<Select id="error" label="Error" error="This is the error message">
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>

Disabled​

Add this class to signal users the field is disabled.

<Select id="disabled" label="Disabled" disabled>
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>

Optional​

<Select id="optional" label="Optional" optional>
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>

Hint​

This is a hint to give more details

<Select id="hint" label="Hint" hint="This is a hint to give more details">
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>

Dense​

Reduce the font size and padding for a more compact appearance.

<Select id="dense" label="Dense" dense>
<option value=""></option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>

HideLabel​

Hide the label visually while keeping it accessible to screen readers.

<Select id="hideLabel" label="Hidden Label" hideLabel>
<option value="">Select an option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</Select>