Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@rmwc/select
Advanced tools
Menus display a list of choices on a transient sheet of material.
Selects come in three different styles: standard, box, and outlined.
import { Select, SelectHelperText } from '@rmwc/select';
<Select
label="Standard"
options={['Cookies', 'Pizza', 'Icecream']}
/>
<Select
label="Outlined"
outlined
options={['Cookies', 'Pizza', 'Icecream']}
/>
<Select
label="Enhanced"
enhanced
options={['Cookies', 'Pizza', 'Icecream']}
/>
<div>
<Select
label="With Icon"
defaultChecked="Pizza"
withLeadingIcon="favorite"
options={['Cookies', 'Pizza', 'Icecream']}
/>
<SelectHelperText>Choose your favorite snack...</SelectHelperText>
</div>
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.
import { Select } from '@rmwc/select';
{/*
A controlled select
Using a formatted array of options
[
{label: string, value: string, ...props},
{label: string, value: string, ...props}
]
*/}
<Select
value={this.state.value}
onChange={evt => this.setState({value: evt.target.value})}
label="Array"
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'
}
]}
/>
{/*
An uncontrolled select
A simple value => label map */
}
<Select
label="Object map"
options={{'1': 'Cookies', '2': 'Pizza', '3': 'Icecream'}}
/>
{/* a simple array of options with box styling, value will be the same as label */}
<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.
import { Select } from '@rmwc/select';
<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.
import { Select } from '@rmwc/select';
<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>
import { DocumentComponent } from '@rmwc/base/utils/document-component';
import * as docs from './docgen.json';
<DocumentComponent docs={docs} displayName="Select" />
4.0.1 (2018-11-28)
FAQs
RMWC Select component
The npm package @rmwc/select receives a total of 2,593 weekly downloads. As such, @rmwc/select popularity was classified as 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.