Svelte Material UI - Select
Select menus provide the user with a choice between multiple items.
Installation
npm install --save-dev @smui/select
Demo
in action: https://sveltematerialui.com/demo/select
demo code: https://github.com/hperrin/svelte-material-ui/blob/master/site/src/routes/demo/select/
Whoa There, These Docs are Outdated
The latest SMUI v3 beta had a lot of changes, and these docs haven't been caught up yet. You should check out the demo page's code to see the latest usage.
Basic Usage
<Select
bind:value={fruitChoice}
label="Fruit"
anchor$class="select-width"
menu$class="select-width"
>
<Option value="" />
{#each fruits as fruit}
<Option value={fruit}>{fruit}</Option>
{/each}
</Select>
<script>
import Select, { Option } from '@smui/select';
let fruits = ['Apple', 'Orange', 'Banana', 'Mango'];
let fruitChoice = '';
</script>
<style>
* :global(.select-width) {
min-width: 200px;
}
</style>
Exports
todo...
More Information
See Dropdown menu in the Material design spec.
See Select in MDC-Web for information about the upstream library's architecture.