Skip to content

Option

Option is an item backed by an <option> element for use inside a ComboBox or List. It suppresses framework positioning styles so the browser renders the option natively.

Usage

typescript
import { ComboBox, Option } from '@jimka/typescript-ui/component/input';
const role = ComboBox();
role.addItem(Option('admin', 'Admin'));
role.addItem(Option('user',  'User'));
role.addItem(Option('guest', 'Guest'));

The constructor takes (key, value):

  • key — programmatic identifier; what comboBox.getValue() returns.
  • value — display text shown in the dropdown.

Common methods

MethodPurpose
getKey() / setKey(key)Programmatic value.
getValue() / setValue(value)Display text.

Notes

  • Option is not the same as ListItem. Use Option for ComboBox / List items; use ListItem for BulletedList / NumberedList items.
  • For store-backed combo boxes, you don't construct Option instances yourself — call comboBox.setStore instead.

See also