List Tile

July 22, 2021 ยท View on GitHub

Displays a list element as part of a List.

Main features

  • Separately set primary, secondary and front content
  • Hover state
  • Selected state
  • Customize ripple effect (center, opacity, speed, color)
  • Compact display
  • Set as sticky header
  • Indent content
  • RTL (right-to-left) support

Usage

Options

List tile content options

ParameterRequiredTypeDefaultDescription
compactoptionalBooleanSet to true to reduce vertical padding
content--See below
disabledoptionalBooleanfalseSet to true to deactivate the url and hover state (in case of List with setting hoverable) and show a disabled state
headeroptionalBooleanfalseSet to true to make this a header tile
highlightoptionalBooleanfalseSet to true to show a highlight state; a selected state always has precedence over a highlight state
hoverableoptionalBooleanfalseSet to true to show a hover effect (non-touch devices)
indentoptionalBooleanfalseSet to true to indent the content
inkoptionalBooleanfalseSet to true to show a ripple effect when the tile is tapped
insetoptionalBooleanfalseSet to true to add side and vertical margins (if set: default 8px)
insetHoptionalBooleanfalseSet to true to add side margins (if set: default 8px)
insetVoptionalBooleanfalseSet to true to add vertical margins (if set: default 8px)
navigationoptionalBooleanfalseSet to true to use a Material Design navigation style
rippleoptional (valid if ink is true)Options objectPass Ripple options to define ripple behavior
roundedoptionalBooleanfalseSet to true to make the highlight and selection rounded
secondaryoptionalObjectOptions for secondary content, see below
selectableoptionalBooleanfalseSet to true to show a mouse pointer (non-touch devices)
selectedoptionalBooleanfalseSet to true to show a selected state
stickyoptionalBooleanfalseMake list tile sticky when scrolling; this is normally set in the List component as header.sticky; does not work in IE or Edge < 16

List tile primary content options

ParameterRequiredTypeDefaultDescription
compactFrontoptionalBooleanfalseSet to true to reduce horizontal width of front content
contentoptionalString, hyperscript or componentAny primary content; ignores title, subtitle, highSubtitle, subContent and children
frontoptionalString, hyperscript or componentContent to show at the left of the primary content
highSubtitleoptionalString, hyperscript or componentSecondary text content (2 lines high)
subContentoptionalString, hyperscript or componentSecondary content (no height restriction)
subtitleoptionalStringSecondary text content (1 line high)
titleoptionalStringThe text content
urloptionalObject with href, optionally oncreate (for Mithril) or onClick (for React) or to (for React Router)URL location; Mithril 2.x: only use url.href and set element to m.route.Link; Mithril 1,x: for in-app route linking set oncreate : m.route.link; React: for in-app route linking use onClick and a router such as react-router-dom

List tile secondary content options

ParameterRequiredTypeDefaultDescription
secondary.contentoptionalString, hyperscript or componentSecondary content
secondary.elementoptionalStringHTML element for secondary content
secondary.iconoptionalObjectIcon options object for icon in secondary content; will be placed above secondary.content
secondary.urloptionalObject with href, optionally oncreate (for Mithril 1.x) or onClick (for React)URL for secondary content; Mithril 2.x: only use url.href and set element to m.route.Link; Mithril 1.x: for in-app route linking set oncreate : m.route.link; React: for in-app route linking use onClick and a router such as react-router-dom

Common component options

ParameterRequiredTypeDefaultDescription
afteroptionalString, hyperscript or componentExtra content after main content; note that this content is placed right of preceding elements with a higher stacking depth
beforeoptionalString, hyperscript or componentExtra content before main content; note that this content is placed left of subsequent elements with a lower stacking depth
classNameoptionalStringExtra CSS class appended to pe-list-tile
elementoptionalString"div"HTML element tag
eventsoptionalObjectOptions object containing one or more standard events such as onclick (React: onClick)
idoptionalStringHTML element id
styleoptionalObjectFor setting simple style attributes
toneoptionalString: "dark" or "light"Renders the component light on dark (sets class pe-dark-tone); use "light" to locally inverse (sets class pe-light-tone)

Composition

List Tile is composed from:

  • Ripple (when option ink is used)
  • Icon (when option secondary.icon is used)

CSS classes