Dark Light
System
Default LBBW Jira Confluence Source Code
Share
Playground

Option

<afp-option> Since 1.0.0 stable This component uses the light DOM, so its markup and styles are part of the regular document flow.

An option component to be used within an AfpSelect.

Option

Examples #

Value #

The value attribute can be used to identify the option when it is clicked.

Toggle checked

Checked #

Use the checked attribute to indicate the checked state of the option.

Checked Option

Closeable #

Use the closeable attribute to add a close button to the option.

Closeable Option

Disabled #

Use the disabled attribute to disable the option.

Disabled Option

Custom Icons #

Use the check-icon and close-icon slots to provide custom icons for the checked and close states.

Option with Custom Icon

Properties

Learn more about properties.

Name Description Reflects
value
The value associated with the option. This is emitted with the afp-click event.
Type string
checked
Indicates whether the option is checked.
Type boolean
Default false
disabled
Indicates whether the option is disabled.
Type boolean
Default false
closeable
Indicates whether the option is closeable.
Type boolean
Default false
size
Size of the option.
Type
AfpSize
Name Description
SMALL
Small size with compact dimensions.
MEDIUM
Medium size with standard dimensions.
LARGE
Large size with expanded dimensions.
AfpSize
Default AfpSize.MEDIUM

Methods

Learn more about using methods.

Name Description Arguments
focus
Sets focus on the option component.
options<FocusOptions> — Focus options.
getClonedContentNodes
Returns cloned content nodes of the option component, excluding empty text nodes.
Return Node[]
-

Events

Learn more about events.

Name Return Description
afp-click string
Emitted when the option is clicked.
afp-close void
Emitted when the option's close icon is clicked. Only emitted if the option is closeable.

Slots

Learn more about slots.

Name Description
default
The default slot.
check-icon
Slot to replace the default check icon.
close-icon
Slot to replace the default close icon.

Internationalization

Learn more about internationalization.

Key Description
option.close-button.aria-label
The default `aria-label` text for the option close 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)
close
The close icon wrapper.
::part(close)
close-icon
The close icon.
::part(close-icon)
actions
The wrapper for the checked and close icons.
::part(actions)

CSS Custom Properties

Name Description Default
--afp-option-checked-min-width
The minimum width of the checked icon area.
1.125rem
--afp-option-disabled-opacity
The opacity of a disabled option.
0.5

Dependencies

The component automatically brings in the listed items, including any nested dependencies that may exist.

afp-icon afp-button

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/option/option.js';
Share
Create a link with a predefined theme that is automatically applied when the generated link is opened. Default LBBW Presentation Mode
Abort Copy Link