v2.0.5

Text List

Installation

Install yarn add @spark-web/text-list
Source GitHub.com
Bundle unpkg.com

List semantics are handled automatically, including the use of ordered lists where appropriate.

  • Bullet
  • Bullet
  • Bullet
  1. Number
  2. Number
  3. Number
  • Icon
  • Icon
  • Icon

Examples

Color, size and gap

Lists support the same sizes and colors as Text, and the same gap as Stack.

  • Large
  • Large
  • Large
  • Standard
  • Standard
  • Standard
  • Small
  • Small
  • Small

Rich content

Use the Stack as a list item to display multiple lines of text.

  • This is a paragraph.
    This is another paragraph.
  • This is a paragraph.
    This is another paragraph.

Nested lists

Lists of varying types can be nested within each other.

  1. Number list
    • Bullet list
    • Bullet list
    • Bullet list
  2. Number list
    • Bullet list
    • Bullet list
    • Bullet list

Props

PropTypeDescription

children

ReactNode: string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

The elements that represent each item in the list.

data?

DataAttributeMap

Sets data attributes for the element.

gap?

ResponsiveProp<"xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge">

The size of the gap between each item.

Default: "large"

icon?

ReactElement<IconProps, string | JSXElementConstructor<any>>

Provide an icon to be used as the "bullet" element.

size?

string | number | symbol

Default the size of child Text elements.

Default: "standard"

tone?

"neutral" | "muted" | "link" | "disabled" | "fieldAccent" | "placeholder" | "accent" | "primary" | "primaryHover" | "primaryActive" | "secondary" | "secondaryHover" | "secondaryActive" | "caution" | "critical" | "info" | "positive"

Default the tone of child Text elements.

Default: "neutral"

type?

"number" | "bullet"

Define the list type. Equivalent to HTML's ordered and unordered lists.

Default: "bullet"

The TextList component also passes extra props into the component's nested Stack component.

© 2023 Brighte Capital Pty Ltd