Products · Components

GridItem

One tile in a Grid: an icon or picture with a short label.

Goes inside a Grid. Keep the label to a word or two, as tiles are narrow.

Children: Nothing

Example

GridItem is used inside Grid:

The Grid component
view.dml
<Grid columns="3" gap="small">
  <GridItem icon="send" label="Send" onTap="open" data-page="send" />
  <GridItem icon="wallet" label="Top up" onTap="open" data-page="top-up" />
  <GridItem icon="receipt" label="Bills" badge="2" onTap="open" data-page="bills" />
</Grid>
controller.ts
export default definePage({
  initialState: {},
  actions: {
    open(_state, event: DataEvent<{ page: 'send' | 'top-up' | 'bills' }>) {
      this.navigation.push(event.data.page);
    },
  },
});

Props

PropTypeWhat it is
labelstring
iconicon name, or one of your own icons
imagestringA picture in place of icon. It takes the same addresses as an Image's src.
badgestringA short note on the item's corner, such as "New" or a count.
disabledbooleanDims it, and the person can't use it. Default: false.

Events

EventSendsNotes
onTapNothing

Keep reading

On this page