Skip to main content

Overview

HuxDropdown is a versatile dropdown/select component that provides multiple visual variants, sizes, and supports custom item rendering with icons. It adapts seamlessly to light and dark themes.

Basic Usage

Variants

HuxDropdown supports four visual variants through the HuxButtonVariant enum:

Primary

The default variant with a filled background using the primary color. Primary Dropdown

Secondary

A subtle variant with a light background and border. Secondary Dropdown

Outline

A transparent dropdown with only a border outline. Outline Dropdown

Ghost

A minimal transparent dropdown without borders. Ghost Dropdown

States

Default

Shows the placeholder text when no value is selected. Dropdown Default

Expanded

Shows the dropdown panel with options. Dropdown Expanded

Selected

Shows the selected option. Dropdown Selected

Disabled

Prevents user interaction. Dropdown Disabled

Sizes

HuxDropdown supports three size variants through the HuxButtonSize enum:

Small

Compact size for tight spaces (32px height). Small Dropdown

Medium

Default size for most use cases (40px height). Medium Dropdown

Large

Prominent size for important selections (48px height). Large Dropdown

With Icons

Enhance dropdown items with icons. Dropdown with icons

Using Item Widget as Value

By default, HuxDropdown extracts and displays text from the selected item’s widget. The useItemWidgetAsValue parameter allows you to display the complete item widget (including icons, badges, and complex layouts) as the selected value.
With this feature enabled, the selected value will show the complete widget with all its visual elements (icons, badges, custom layouts), providing a richer visual experience compared to text-only representation.

Custom Colors

Override the primary color of the dropdown. Custom Dropdown

API Reference

HuxDropdown Properties

HuxDropdownItem Properties

Accessibility

HuxDropdown includes several accessibility features:

Automatic Contrast

Text color is automatically calculated to ensure WCAG AA compliance (4.5:1 contrast ratio) against any background color.

Keyboard Navigation

  • Arrow keys to navigate items
  • Enter/Space to open/close and select
  • Escape to close dropdown

Focus States

Proper focus management and visible focus indicators.

Semantic Labels

Clear labels and roles for screen readers.

Best Practices

  • Use Large for primary selection fields
  • Use Medium for most standard forms
  • Use Small for compact interfaces or filters
  • Use descriptive placeholders
  • Group related dropdowns logically
  • Consider adding helper text for complex selections
  • Keep items concise
  • Use icons to enhance visual scanning
  • Order items logically (e.g., alphabetically)

Examples

Form Building

See dropdowns in action within forms

Custom Theming

Apply custom colors and themes

Accessibility

Ensure your dropdowns are accessible

Data Visualization

Use dropdowns for data filtering