Products · Components

ListItem

One row in a List: a title, a subtitle, an icon or picture, and a value or badge at the end.

Anything you put inside it, such as a Badge, shows at the end in place of value.

Children: Components

Example

The ListItem component
view.dml
<List>
  <ListItem icon="receipt" title="Electricity" subtitle="Meter 0412 3456 789" onTap="open" data-id="electricity">
    <Badge tone="warning">Due</Badge>
  </ListItem>
</List>
controller.ts
export default definePage({
  initialState: {},
  actions: {
    open(_state, event: DataEvent<{ id: string }>) {
      this.navigation.push('bill', { id: event.data.id });
    },
  },
});

Props

PropTypeWhat it is
titlestring
subtitlestring
valuestring
iconicon name, or one of your own icons
imagestringA picture at the start of the row, in place of icon. It takes the same addresses as an Image's src.
disabledbooleanDims it, and the person can't use it. Default: false.
padding, paddingTop, paddingStart, paddingEnd, paddingBottomspacingSpace inside its edges, all round or on one side.

Events

EventSendsNotes
onTapNothingA tappable item shows a chevron.

Keep reading

On this page