Option

Options define the selectable items within various form controls such as select.

Use the disabled attribute to disable an option and prevent it from being selected.

Option 1 Option 2 Option 3

Add icons to the start and end of menu items using the prefix and suffix slots.

Doctor Nurse Patient
import '@ods/components/web.option';

Note: You only need to import a web component once in your code, as it registers itself globally when defined, allowing you to use it anywhere within your application without needing to re-import it each time you want to use the component.

Slots

NameDescription
(default)The option's label.
prefixUsed to prepend an icon or similar element to the menu item.
suffixUsed to append an icon or similar element to the menu item.

Properties

Please note, both DOM properties and HTML attributes are shown in the table below. Unless otherwise specified, the property and attribute names are identical.

Property/AttributeReflectsTypeDefault
current
booleanfalse
selected
booleanfalse
value
string''
disabled
booleanfalse

Methods

NameDescriptionArguments
getTextLabel()Returns a plain text label based on the option's content.--

Parts

NameDescription
checked-iconThe checked icon, an `<ods-icon>` element.
baseThe component's base wrapper.
labelThe option's label.
prefixThe container that wraps the prefix.
suffixThe container that wraps the suffix.

Dependencies

This component automatically imports the following dependencies.

  • ods-icon

Search