Skip to content

ListItem

ListItem is a single list item backed by a <li> element. Stores a key/value pair and suppresses framework positioning styles so the browser can render the item natively inside a list.

ListItem is used inside BulletedList and NumberedList.

Usage

typescript
import { BulletedList, ListItem } from '@jimka/typescript-ui/component/list';
const list = BulletedList();
list.addItem(ListItem('apple',  'Apple'));
list.addItem(ListItem('banana', 'Banana'));
list.addItem(ListItem('cherry', 'Cherry'));

panel.addComponent(list);

Common methods

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

Notes

  • ListItem is not the same as Option. Use Option for items inside a ComboBox or List; use ListItem for items inside a BulletedList / NumberedList.

See also