BumblebeeBumblebee

Data table

Live demo

Data table

Simple Data table
Company nameDisplay nameContact emailPhone number
Paddy's Irish PubPaddy'ssunny@phili.com+1-555-555-5555
Martian Congressional Republic NavyMCRNbobbie@rocinante.com+1-555-555-1234
Cyberdyne Systems CorporationCyberdyne Systemsjconnor@skynet.com+1-555-555-3577
Sirius Cybernetics CorporationSirius Corp.complaints@sirius.com+1-555-555-3346
Paper Street Soap CompanyPaper Streettdurden@soap.com+1-555-555-6864
Combine Honnete Ober MercantilesCHOAMmelange@dune.com+1-555-555-4723
Weasleys' Wizard WheezesWeasleyspygmypuffs@weasleys.com+1-555-555-8932

Variant options of text in columns

The optional `variant` prop on a `ColItem` sets the text variant on all the data cells for that column. It is `caption150` by default

Simple Data table
Company nameDisplay nameContact emailPhone numberActions
Paddy's Irish PubPaddy'ssunny@phili.com+1-555-555-5555
Martian Congressional Republic NavyMCRNbobbie@rocinante.com+1-555-555-1234
Cyberdyne Systems CorporationCyberdyne Systemsjconnor@skynet.com+1-555-555-3577
Sirius Cybernetics CorporationSirius Corp.complaints@sirius.com+1-555-555-3346
Paper Street Soap CompanyPaper Streettdurden@soap.com+1-555-555-6864
Combine Honnete Ober MercantilesCHOAMmelange@dune.com+1-555-555-4723
Weasleys' Wizard WheezesWeasleyspygmypuffs@weasleys.com+1-555-555-8932

Special column types

The `tight` prop on a `ColItem` minimizes the width of the column and this allows other columns to expand for visual priority. The `nowrap` prop on a `ColItem` prevents the text from wrapping. There is a custom type of 'actions' which is designed be used for the far column with actions. By default this wraps the header in ScreenReaderOnly component.

Simple Data table
User nameEmailActions
Paddy's Irish Pubsunny@phili.com
Martian Congressional Republic Navybobbie@rocinante.com
Cyberdyne Systems Corporationjconnor@skynet.com
Sirius Cybernetics Corporationcomplaints@sirius.com
Paper Street Soap Companytdurden@soap.com
Combine Honnete Ober Mercantilesmelange@dune.com
Weasleys' Wizard Wheezespygmypuffs@weasleys.com

Code

Standard data table

import { DataTable } from '@shieldpay/bumblebee/data-table';

<DataTable caption="Simple Data table" rows={rows} columns={columns} />;

Data table with interactive rows

import { DataTable } from '@shieldpay/bumblebee/data-table';

const columnsWithLink = [
  { headerName: 'Company Name', field: 'name' },
  { headerName: 'Display Name', field: 'displayName' },
  { headerName: 'Contact email', field: 'email' },
  { headerName: 'Phone number', field: 'number', type: 'number' },
];

const rows = [
  {
    id: 1,
    name: 'Sample name 1',
    displayName: 'sample1',
    email: 'sampleemail@spg.com',
    number: '+1-555-555-5555',
  },
  {
    id: 2,
    name: 'Sample name 2',
    displayName: 'sample2',
    email: 'sampleemaill2@spg.com',
    number: '+1-555-555-1234',
  },
];

Data table with variants of text in columns

import { DataTable } from '@shieldpay/bumblebee/data-table';
const columnsWithLVariant = [
  { headerName: 'Company Name', field: 'name', variant: 'captionMedium150' },
  {
    headerName: 'Display Name',
    field: 'displayName',
    variant: 'captionMedium150',
  },
  { headerName: 'Contact email', field: 'email', variant: 'captionMedium150' },
  {
    headerName: 'Phone number',
    field: 'number',
    type: 'number',
    variant: 'captionMedium150',
  },
];
const rows = [
  {
    id: 1,
    name: 'Sample name 1',
    displayName: 'sample1',
    email: 'sampleemail@spg.com',
    number: '+1-555-555-5555',
  },
  {
    id: 2,
    name: 'Sample name 2',
    displayName: 'sample2',
    email: 'sampleemaill2@spg.com',
    number: '+1-555-555-1234',
  },
];