![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@rmwc/select
Advanced tools
Menus display a list of choices on a transient sheet of material.
Selects come in three different styles: standard,outlined, and enhanced.
<Select label="Standard" options={['Cookies', 'Pizza', 'Icecream']} />
<Select
label="Outlined"
outlined
options={['Cookies', 'Pizza', 'Icecream']}
/>
<Select
label="Enhanced"
enhanced
options={['Cookies', 'Pizza', 'Icecream']}
/>
<Select
label="With Icon"
defaultValue="Pizza"
helpText="Choose your favorite snack..."
icon="favorite"
options={['Cookies', 'Pizza', 'Icecream']}
/>
<Select
label="Required"
required
options={['Cookies', 'Pizza', 'Icecream']}
/>
<Select
label="Invalid"
invalid
options={['Cookies', 'Pizza', 'Icecream']}
/>
<Select
label="Disabled"
disabled
options={['Cookies', 'Pizza', 'Icecream']}
/>
To fit common use cases, RMWC Select provides a data driven method for rendering select menus. There are multiple formats you can pass data in, use the one that best fits your requirements. To make your label not float by default and to have an unselected blank value, set the placeholder
prop to a blank string.
function Example() {
// A controlled select Using a formatted array of options
const options = [
{
label: 'Cookies',
value: '1'
},
{
label: 'Pizza',
value: '2',
/** Any additional items will be passed to the
child ListItem as props */
'aria-disabled': true,
tabIndex: -1
},
{
label: 'Icecream',
value: '3'
}
];
return <Select label="Array" options={options} />;
}
<Select
label="Object map"
options={{ '1': 'Cookies', '2': 'Pizza', '3': 'Icecream' }}
/>
<Select
label="Simple Array"
placeholder="-- Select One --"
options={['Cookies', 'Pizza', 'Icecream']}
/>
If you want full control over the child ListItems
, you can manually build the list yourself.
<Select label="Manual" defaultValue="Cookies">
<option value="Cookies">Cookies</option>
<option value="Pizza">Pizza</option>
<option value="Icecream">Icecream</option>
</Select>
Both native and enhanced Selects can contain option groups. Just nest additional options arrays in your data.
<Select
label="Formatted"
enhanced
options={[
{
label: 'Dinner',
options: [
{
label: 'Pizza',
value: '2'
}
]
},
{
label: 'Dessert',
options: [
{
label: 'Cookies',
value: '1'
},
{
label: 'Icecream',
value: '3'
}
]
}
]}
/>
<Select label="Manually Built">
<optgroup label="Dinner">
<option value="Pizza">Pizza</option>
</optgroup>
<optgroup label="Dessert">
<option value="Cookies">Cookies</option>
<option value="Icecream">Icecream</option>
</optgroup>
</Select>
A Select Component
Name | Type | Description |
---|---|---|
disabled | undefined | false | true | Makes the Select disabled. |
enhanced | boolean | MenuProps | Renders a non native / enhanced dropdown |
helpText | React.ReactNode | SelectHelperTextProps | Adds help text to the field |
icon | RMWC.IconPropT | Add a leading icon. |
inputRef | undefined | (ref: HTMLSelectElement | null) => void | A reference to the native select element. Not applicable when enhanced is true. |
invalid | undefined | false | true | Makes the Select visually invalid. This is sometimes automatically my material-components-web. |
label | undefined | string | A label for the form control. |
options | FormattedOption[] | string[] | { [value: string]: string } | Options accepts flat arrays, value => label maps, and more. See examples for details. |
outlined | undefined | false | true | Makes the select outlined. |
placeholder | undefined | string | Placeholder text for the form control. Set to a blank string to create a non-floating placeholder label. |
required | undefined | false | true | Makes the Select required. |
rootProps | Object | Props for the root element. By default, additional props spread to the native select element. |
value | undefined | string | The value for a controlled select. |
FAQs
RMWC Select component
The npm package @rmwc/select receives a total of 0 weekly downloads. As such, @rmwc/select popularity was classified as not popular.
We found that @rmwc/select demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.