Skip to content

ListItem ​

ListItem is one entry of a list: its columns hold a mark, a name and the things at its end.

When to use ​

Use it for each item of a List; a line of a table is a row of a Table. An item that opens something takes onclick (Enter and Space press it too, except in a field inside it) or href; one that is only read takes plain, and then a rule under it, or a surface, so that its edge can be seen. sel marks the selected item; set aria-selected or aria-current on it as the list requires. When the item ends with an icon button, tail lines the icon up with the edge of the text.

Props ​

PropDefaultDescription
columnsrequiredThe columns (grid-template-columns)
onclickMakes the item pressable
hrefRenders a link
plainfalseNot pressed: no hover surface
disabledfalseWith onclick: cannot be pressed now
selfalseSelected
rulefalseA line under the item, except the last
tailfalsepad-sm at the right, for an icon button
onkeydownCalled on a key; preventing it keeps the key
childrenrequiredThe content of the columns

Other attributes (aria-*, data-*) go to the element.

Contract ​

The height comes from the content. The least height is --kata-height-list-item, the ink of the text and md above and below, or the height the list declares with rows. Every visible thing in it, a mark, a thumbnail, a control with a line or a surface and stacked content, keeps md above and below, and the item grows to fit; an icon or a markbox does not push. The columns are gap-sm apart; pad-md at the sides, or the inset the container declares. Bare text is trimmed to its ink and ends with an ellipsis. Controls inside are small buttons. Hover shows the raise surface; selected is the raise surface and a blue line of two at the left; the focus ring is drawn inside. Disabled, an item pressed with onclick is the same shape without hue, as a disabled Button: dimmed, without hover, not pressed by a click or a key, aria-disabled="true" and out of the tab order.

Example ​

ListItem

Released under the Apache-2.0 license.