Blossom UI

Table

Table component with sortable columns, row selection, custom cells, striped rows and an empty state.

How to use it

Run npx @blossomui/react add table, or copy src/components/UI/Table/Table.tsx into your React project and import it.

import { Table } from './components/ui/Table'

Props

TableColumn

PropTypeDescription
key (required)string
header (required)string
render(row: T) => ReactNodeCustom cell. Without it the value of `row[key]` is shown.
sortablebooleanLets the user sort the rows by this column.
sortValue(row: T) => string | numberValue used to sort the rows when the cell is custom and `row[key]` is not what you see.
align'left' | 'right' | 'center'

TableProps

PropTypeDescription
labels{ selectAll?: string; selectRow?: string; previous?: string; next?: string; showing?: (from: number, to: number, total: number) => string; page?: (page: number, total: number) => string }Texts of the component. Pass only the ones you want to change, for example to translate it.
pageSizenumberRows per page. Without it all the rows are shown.
pagenumberCurrent page, starting at 1. Use it with `onPageChange` to control the page.
onPageChange(page: number) => void
colorstringAccent color of this component: any CSS color. Without it the component uses `--blossom-accent`, which is pink by default.
columns (required)TableColumn<T>[]
rows (required)T[]
rowKey (required)(row: T) => stringReturns a unique id for each row.
selectablebooleanAdds a checkbox column.
onSelectionChange(selected: T[]) => void
emptyReactNodeShown when there are no rows.
stripedboolean
captionstring

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree