List
Displays ordered and unordered lists.
View in Storybook (opens in a new tab)
Installation
import { List } from "@ginga-ui/core";Unordered list
An example of an unordered list (ul).
- List item 1
- List item 2
- List item 3
list.tsx
import { List, ListItem } from "@ginga-ui/core";
export function UnorderedExample() {
return (
<List type="unordered">
<ListItem>List item 1</ListItem>
<ListItem>List item 2</ListItem>
<ListItem>List item 3</ListItem>
</List>
);
}Ordered list
An example of an ordered list (ol).
- First step
- Second step
- Final step
list.tsx
import { List, ListItem } from "@ginga-ui/core";
export function OrderedExample() {
return (
<List type="ordered">
<ListItem>First step</ListItem>
<ListItem>Second step</ListItem>
<ListItem>Final step</ListItem>
</List>
);
}Nested list
Nest lists to create a hierarchy.
- Parent item 1
- Parent item 2
- Nested item 1
- Nested item 2
- Parent item 3
list.tsx
import { List, ListItem } from "@ginga-ui/core";
export function NestedExample() {
return (
<List type="unordered">
<ListItem>Parent item 1</ListItem>
<ListItem>
Parent item 2
<List type="unordered">
<ListItem>Nested item 1</ListItem>
<ListItem>Nested item 2</ListItem>
</List>
</ListItem>
<ListItem>Parent item 3</ListItem>
</List>
);
}Mixed list
A list that combines ordered and unordered lists.
- Define requirements for the task management system
- UI/UX design
- Create wireframes
- Design mockups
- Usability testing
- Development and testing
- Deployment
list.tsx
import { List, ListItem } from "@ginga-ui/core";
export function MixedExample() {
return (
<List type="ordered">
<ListItem>Define requirements for the task management system</ListItem>
<ListItem>
UI/UX design
<List type="unordered">
<ListItem>Create wireframes</ListItem>
<ListItem>Design mockups</ListItem>
<ListItem>Usability testing</ListItem>
</List>
</ListItem>
<ListItem>Development and testing</ListItem>
<ListItem>Deployment</ListItem>
</List>
);
}Props
List
| Name | Type | Default | Description |
|---|---|---|---|
type | "ordered" | "unordered" | "unordered" | "ordered" renders an ol element and "unordered" renders a ul element. |
render | (props) => ReactElement | - | Replaces the root element. Return an element that receives the given props, such as next/link. |
Also accepts the attributes of the HTML ul (opens in a new tab) / ol (opens in a new tab) element.
ListItem
| Name | Type | Default | Description |
|---|---|---|---|
render | (props) => ReactElement | - | Replaces the root element. Return an element that receives the given props, such as next/link. |
Also accepts the attributes of the HTML li (opens in a new tab) element.