Live demo
Demo source
A dropdown item is one entry in the content slot of a
dropdown. The design guidelines call it
the field dropdown item partial.
- Give each option a
valueand alabel. The label is the text shown in the field once the option is selected. - Put rich content, such as an avatar and supporting text, in the item's default slot.
- Set
disabledfor an option that cannot be chosen. - Set
detachedfor an action, such as adding a new entry. It is not filtered out and does not change the value.
Anatomy
See the dropdown anatomy for the parent field composition. This item belongs to its options list.
List variants and grouping
Use label for a simple option. For the design's complex variant, provide
custom content in the default slot and keep label as the text the parent
shows after selection. Add separators between related options in the
parent's content slot with hr.
The design calls these menu-item and divider partials. In a form dropdown,
use nv-fielddropdownitem; nv-menuitem belongs to an action menu.
Hover and keyboard highlight come from interaction, while disabled makes
an option unavailable. Field validation belongs to the parent dropdown.
Guidelines
Keep labels short and familiar. Use a simple item unless the extra icon or description helps people distinguish options. Keep related options together; for two or three choices, consider visible radios or buttons instead.