Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
  • Overlays
  • Feedback & status
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
    • Alert
    • ButtonDeprecated
    • Collection
    • DateInputDeprecated
    • Dropdown
    • Frame
    • FullWidthModal
    • LegacyTable
    • SearchInputDeprecated
    • SelectOptionItem
    • Table
    • TextDeprecated
    • TooltipDeprecated
  • Deprecated
  • Collection

Collection

Deprecated

Deprecated component

Do not use it in new code. It stays documented to help migrate its remaining usages.

Use instead:

  • Table from murray/web: For tabular data on web.
  • DataTable from murray/advanced/data-table: For a configurable web table with filters, selection and pagination.
  • ListItem from murray/web: For a list of rows on web.
  • ListItem from murray/mobile: For a list of rows on mobile.

Lays items out in a set number of columns, under a shared header. Use for a grid of cards.

Health
Component health
Source
View on Github
Design
View Figma
Storybook
View in Storybook
Playground
No Example
Accessibility
unknown
Platform
Universal
  • Overview
  • Props
  • Figma

Basic usage​

  1. Specify the number of columns you want to display in the Collection component.
  2. Add a collection header to define the title.
  3. Add as many Collection.Item components as needed, ensuring each has the same number of children as the columns you specified.

Collection demo

Item 1 - Column 1

Item 1 - Column 2

Item 1 - Column 3

Item 2 - Column 1

Item 2 - Column 2

Item 2 - Column 3

Bleeding variant​

Expend the border of the Collection.Header to create a visually appealing finish that fully utilizes the available space. You can adjust the padding or margin of your container by using the bleedingOffset prop.

Collection demo

Item 1 - Column 1

Item 1 - Column 2

Item 1 - Column 3

Item 2 - Column 1

Item 2 - Column 2

Item 2 - Column 3

Advanced usages​

With row links​

Just wrap the Collection.Item in an A, Link, React router Link, or NavLink to make it clickable.

👉 Don't forget to add the hasLinkArrow prop to the Collection.Item to add the arrow icon.

🌐 If you're building a universal component, we recommend you to rely as much as possible on A to manage the link.

Collection demo

Item 1 - Column 1
Item 1 - Column 2
Item 1 - Column 3
Item 2 - Column 1
Item 2 - Column 2
Item 2 - Column 3

With a right section​

If you need to align a component to the right of the Collection.Item, you can use the rightSection prop.

Collection demo

Item 1 - Column 1

Item 1 - Column 2

Item 1 - Column 3

Item 2 - Column 1

Item 2 - Column 2

Item 2 - Column 3

Enhanced first column​

By passing a title or a description to the Collection.Item, it will be rendered in the first column with predefined styles.

Collection demo

Item title

An additional description

Item 1 - Column 2

Item 1 - Column 3

Item title

An additional description

Item 2 - Column 2

Item 2 - Column 3

Handling possible empty columns​

The display of the component is based on the number of children of Collection.Item. Make sure you have the exact number of children according to the columns number.

For example, don't use a React fragment to display multiple children.

Don't

<Collection.Item>
<Text>Item X - Column 1</Text>
{/* Don't */}
{YOUR_CONDITION && (
<>
<Text>Item X - Column 2</Text>
<Text>Item X - Column 3</Text>
</>
)}
</Collection.Item>

Do

<Collection.Item>
<Text>Item 2 - Column 1</Text>
{/* Do */}
{YOUR_CONDITION && <Text>Item 2 - Column 2</Text>}
{YOUR_CONDITION && <Text>Item 2 - Column 3</Text>}
</Collection.Item>

Playground​

Loading...
tip
This component is universal, its usage is the same in murray and murray/mobile.

Collection props

NameTypeDefault ValueDescriptionUsage count
bleedingbooleanundefineddefaultContext.bleedingMakes the separator under the header overflow. Preferably used on full-page layouts
bleedingOffset
58 possibilitiesundefinednumber"$0""$1""$2""$4""$6""$8""$10""$12""$14""$16""$20""$24""$28""$32""$36""$40""$44""$48""$56""$64""$80""$96""$112""$128""$144""$160""$176""$192""$px0""$px1""$px2""$px4""$px6""$px8""$px10""$px12""$px14""$px16""$px20""$px24""$px28""$px32""$px36""$px40""$px44""$px48""$px56""$px64""$px80""$px96""$px112""$px128""$px144""$px160""$px176""$px192"
defaultContext.bleedingOffsetDefine the size of the bleeding. Ensure it matches the padding of the container (default is $px40)
children*ReactNodeShould contain at least one <Collection.Header/> and as many as you want of <Collection.Item/>. You can also wrap <Collection.Item/> with any link components to make them pressable
columnsnumbernullundefineddefaultContext.columnsDefine the number of columns you want visually in your collection
highlightOnHoverbooleanundefineddefaultContext.highlightOnHoverHighlights the entire line on hover. Preferably used with the bleeding mode

Collection.Item props

NameTypeDefault ValueDescriptionUsage count
descriptionstringundefinedDefine the description of your item. If defined, it will be added at the start of the row
hasLinkArrowbooleanundefinedfalse
leftSectionReactNodeOnly displayed if you define a title or a description. Allows you to use components to illustrate your row. Size is fixed to 40px and the component will be centered inside it. We recommend to use a maximum of 32px for your Icons, Blobbys, Emojis...
rightSectionReactNodeAllows you to add components at the end of your row.
titlestringundefinedDefine the title of your item. If defined, it will be added at the start of the row

Collection.Header props

NameTypeDefault ValueDescriptionUsage count
labelstringundefinedAdditional label next to the title in different level of gray. Useful to add a counter for example
titlestringundefinedTitle of your collection
Edit this page
Previous
ButtonDeprecated
Next
DateInputDeprecated
  • Basic usage
  • Bleeding variant
  • Advanced usages
    • With row links
    • With a right section
    • Enhanced first column
    • Handling possible empty columns
  • Playground