NUI-Widgets documentation has moved to Storybook hosted on Github Pages.

CardDeck

import CardDeck from '@concur/nui-widgets/lib/Cards/CardDeck';

A CardDeck is a container holding a collection of ‘Cards’ that represent similar types of information (e.g. expense reports, invoices, apps, etc.). All cards contained in a card deck will be the same size and a card deck should only contain one CardCreate component.

Examples

Alignment

Use the alignment property to define the layout of cards within a card deck. Left-aligned and centered card decks will retain the standard spacing between cards, whereas justified card decks may increase spacing between cards to span the full width of the card deck container.

<CardDeck>
    <CardCreate onClick={() => {}} title='Create New Card' />
    <Card onClick={() => {}}>Card 1</Card>
    <Card onClick={() => {}}>Card 2</Card>
</CardDeck>

<CardDeck alignment='justify'>
    <CardCreate onClick={() => {}} title='Create New Card' />
    <Card onClick={() => {}}>Card 1</Card>
    <Card onClick={() => {}}>Card 2</Card>
</CardDeck>

<CardDeck alignment='center'>
    <CardCreate onClick={() => {}} title='Create New Card' />
    <Card onClick={() => {}}>Card 1</Card>
    <Card onClick={() => {}}>Card 2</Card>
</CardDeck>

Custom Size

The default size of a card is 268 pixels wide by 214 pixels high. This fits four cards on each row on a full-width container on a large viewport. Consumers can define a custom card size by using cardWidth and cardHeight properties.

<CardDeck cardHeight='250px' cardWidth='150px'>
    <CardCreate onClick={() => {}} title='Create New Card' />
    <Card onClick={() => {}}>Card 1</Card>
    <Card onClick={() => {}}>Card 2</Card>
</CardDeck>

Usage

Properties

Property Type Default Description
alignment String 'left' Alignment of cards within the card deck. Options are 'left', 'justify', 'center'. The 'left' option will keep standard spacing between cards, but may not line up with the right edge of the container. The 'justify' option may increase space between cards so the last card of a full row will line up on the right edge of the container. The 'center' option will keep standard spacing between cards, but may not line up with either the left or right edge of the container.
cardHeight String   Custom height for each Card in the CardDeck. Include both size and a unit (e.g. 200px, 20%, 25vw, etc.)
cardWidth String   Custom width for each Card in the CardDeck. Include both size and a unit (e.g. 200px, 20%, 25vw, etc.)
children Node   Collection of Card and/or CardCreate components to be placed in the card deck.
className String   Custom classes to add to the card deck’s <ul> tag.