Variants
Example of List - default
<BcList> <BcList.Item>Item one</BcList.Item> <BcList.Item>Item two</BcList.Item> </BcList>
React documentation
Last modified:
To start using the BcList
component in your project, ensure you import it as following:
import { BcList } from '@bugcrowd/bc-elements'
BcList props
Prop | Type | Required? | Default | Purpose |
---|---|---|---|---|
children | string | required | Used to display the contents of the list. | |
as | string | optional | ul | Used to set ul or ol as root element. |
isLined | boolean | optional | false | Used to define a line between items. |
spacing | string | optional | Used to define spacing between items. | |
variant | string | optional | Used to switch between different variants. |
Possible values for as
prop
as values | Purpose |
---|---|
ul | Used to set ul as root element. |
ol | Used to set ol as root element. |
Possible values for spacing
prop
spacing values | Description |
---|---|
spacious | Sets a wider space between items in the list. |
compact | Sets a more compact spacing between items in the list. |
Possible values for variant
prop
variant values | Description |
---|---|
bullet | Used to display bullet for each items in the list. |
inline | Used to display items inline in the list. |
middot | Used to extend the inline variant’s styles and add a middot as a pseudo-element. |
number | Used to display numbered list, It is preferable to use ol as root element for number variant. |
Any extended types:
React.HTMLAttributes<HTMLUListElement>
ifas='ul'
is trueReact.OlHTMLAttributes<HTMLOListElement>
ifas='ol'
is true
BcList.Item
Items are the list items displayed for either ordered or unordered lists. It accepts default <li>
attributes and has no props.
Any extended types: React.LiHTMLAttributes<HTMLLIElement>
HTML
Last modified:
Add .bc-list
to an <ul>
or <ol>
element.
Ensure you’re using the correct semantic list to group list items:
- Choose a semantically appropriate list based on the nature of your content
<ul>
for unordered lists<ol>
for ordered lists
- Do not use lists for layout purposes
Design
Last modified:
The following variants are available:
Variant | Purpose |
---|---|
.bc-list--numbered | Used for a list when an inherent order, priority, or sequence needs to be communicated. Use an <ol> when using this variant. |
.bc-list--bulleted | Used for a list that don’t need to be in a specific order |
.bc-list--lined | Used for a list with a bottom bordered separator |
.bc-list--inline | Used for list to display horizontally |
.bc-list--middot | Used for horizontal list only, with a dot as a separator between items |
.bc-list--compact | Used for list when there is limited space for a list, this will reduce the space between items |
.bc-list--spacious | Used for list for allowing more space between items |
Best practices
- The
--numbered
and--bulleted
variants are mutually exclusive - The spacing variants (
--compact
&--spacious
) are mutually exclusive and can be chained with all other variants - The
--middot
variant extends the--inline
variant’s styles, omitting the need to chain these two classes together - The
--lined
variant should not be used with the--inline
or--middot
variants
Accessibility
Last modified:
- Write clear and concise lists, avoid lengthy paragraphs
- Group related items together within a list to help users understand the context and relationship between list items
Rationale
Last modified:
Lists are essential for structuring and organizing content in a clear and meaningful way. They help improve readability, understandability and accessibility.
See also
Last modified: