Text List
Installation
yarn add @spark-web/text-list
List semantics are handled automatically, including the use of ordered lists where appropriate.
Examples
Color, size and gap
Lists support the same sizes and colors as Text, and the same gap as Stack.
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.
- Number list
- Bullet list
- Bullet list
- Bullet list
- Number list
- Bullet list
- Bullet list
- Bullet list
Props
Prop | Type | Description |
---|---|---|
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: |
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: |
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: |
type? | "number" | "bullet" | Define the list type. Equivalent to HTML's ordered and unordered lists. Default: |
The TextList
component also passes extra props into the component's nested
Stack
component.