enes

Dropdown

import { Dropdown } from 'fluentui-svelte';

El componente Dropdown permite a los usuarios seleccionar una opción de una lista. Admite varios tamaños, estados deshabilitados y opciones personalizables para mejorar la interacción del usuario.

Usage

<script>
	import { Dropdown, DropdownOption } from 'fluentui-svelte';
</script>

<Dropdown>
	<DropdownOption value="A" text="Option A">Option A</DropdownOption>
	<DropdownOption value="B" text="Option B">Option B</DropdownOption>
</Dropdown>

Custom Option Content

Options can render any content, such as a Persona. Pass a text prop so the closed dropdown can still display the selection.

Multiple Selection

Set the multiple prop to allow selecting more than one option.

Component Props

NameTypeDescription
valuebindable string \| string[]The selected value, or an array of values when multiple is set.
multiplebooleanAllow selecting more than one option.
placeholderstringText shown when no option is selected. Default: 'Select an option'.
disabledbooleanDisables user interaction.
flyoutMaxHeightnumberMaximum height of the options flyout before it scrolls.
namestringName of the underlying form control.
refbindable HTMLElementThe DOM reference of the dropdown element.
childrenSnippetThe DropdownOption items to render.
NameTypeDescription
valuestringThe value of the option, used for selection.
textstringPlain-text label used to display the selection when the flyout is closed.
childrenSnippetThe content rendered for the option (can be rich content such as a Persona).