Dropdown Item
<afp-dropdown-item>
A dropdown item component to be used within an AfpDropdown.
Examples #
Details #
Use the details slot to add additional information to the dropdown item.
Value #
The value attribute can be used to identify the dropdown item when it is clicked.
Checked #
Use the checked attribute to indicate the checked state of the dropdown item.
Active #
Use the active attribute to indicate the active state of the dropdown item.
Disabled #
Use the disabled attribute to disable the dropdown item.
Custom Icons #
Use the check-icon slot to add a custom icon when the dropdown item is checked.
Custom Height #
Use the --afp-dropdown-item-height CSS variable to set a custom height for the dropdown item.
Properties
Learn more about properties.
| Name | Description | Reflects |
|---|---|---|
value
|
The value associated with the dropdown item. This is emitted with the afp-click event.
Type
string
|
|
checked
|
Indicates whether the dropdown item is checked.
Type
boolean
Default
false |
|
active
|
Indicates whether the dropdown item is active (highlighted).
Type
boolean
Default
false |
|
disabled
|
Indicates whether the dropdown item is disabled.
Type
boolean
Default
false |
|
Methods
Learn more about using methods.
| Name | Description | Arguments |
|---|---|---|
focus
|
Sets focus on the dropdown item.
|
options<FocusOptions>
— Optional focus options.
|
activate
|
Activates the dropdown item, triggering the click handler.
|
- |
Events
Learn more about events.
| Name | Return | Description |
|---|---|---|
afp-click
|
string
|
Emitted when the dropdown item is clicked.
|
Slots
Learn more about slots.
| Name | Description |
|---|---|
default
|
The default slot.
|
details
|
Slot for additional details or description.
|
check-icon
|
Slot to replace the default check icon.
|
CSS Parts
Learn more about CSS Parts.
| Name | Description | Selector |
|---|---|---|
base
|
The component's base wrapper.
|
::part(base)
|
content
|
The content wrapper.
|
::part(content)
|
checked
|
The checked icon wrapper.
|
::part(checked)
|
check-icon
|
The check icon.
|
::part(check-icon)
|
label
|
The label wrapper.
|
::part(label)
|
details
|
The details wrapper.
|
::part(details)
|
CSS Custom Properties
| Name | Description | Default |
|---|---|---|
--afp-dropdown-item-height
|
The height of the dropdown item.
|
--afp-size-xs
|
--afp-dropdown-item-checked-min-width
|
The minimum width of the checked icon area.
|
1.125rem
|
--afp-dropdown-item-disabled-opacity
|
The opacity of a disabled dropdown item.
|
0.5
|
Dependencies
The component automatically brings in the listed items, including any nested dependencies that may exist.
| Component | CSS Part Prefix |
|---|---|
|
|
check-icon
- The check icon.
|
Importing
Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.
import '@afp-design-system/core/dist/components/dropdown-item/dropdown-item.js';