Skip to main content

Format builder UI

Prop showFormatBuilder — adapter chrome, default false.

Guide

When to use it

Let end-users build conditional-formatting rules at runtime — no code, no redeploy.

How it works

Adds a "Formats (n)" toolbar button opening a panel that hosts <BstConditionalFormatBuilder>. Users add / edit / delete conditionalFormats rules (uncontrolled local state by default; pass onConditionalFormatsChange to own them).

Gotchas

  • Hidden while enableConditionalFormatting is off — the builder has nothing to drive.
  • The builder's columns are auto-derived from the grid's columns.

Live example

Format builder — build conditional-format rules at runtime

Example source
import React from 'react'
import { BstTableMui } from '@bloomskill/table-mui'
import type { BstTableColumn } from '@bloomskill/table-engine'
import '@bloomskill/table-engine/styles.css'
type Row = { id: string; name: string; team: string; role: string; score: number }
const seed: Row[] = [
{ id: '1', name: 'Ada Lovelace', team: 'Platform', role: 'Engineer', score: 92 },
{ id: '2', name: 'Alan Turing', team: 'Research', role: 'Scientist', score: 88 },
{ id: '3', name: 'Grace Hopper', team: 'Platform', role: 'Engineer', score: 95 },
{ id: '4', name: 'Katherine J.', team: 'Research', role: 'Analyst', score: 90 },
{ id: '5', name: 'Edsger Dijkstra', team: 'Platform', role: 'Architect', score: 84 },
]
const columns: BstTableColumn<Row>[] = [
{ id: 'name', accessorKey: 'name', header: 'Name' },
{ id: 'team', accessorKey: 'team', header: 'Team' },
{ id: 'role', accessorKey: 'role', header: 'Role' },
{ id: 'score', accessorKey: 'score', header: 'Score', sortFn: 'basic' },
]
export default function App() {
const [rules, setRules] = React.useState([
{ columnId: 'score', when: { op: 'gte', value: 90 }, style: { background: '#dcfce7', color: '#166534' } },
])
return (
<BstTableMui data={seed} columns={columns} getRowId={(r) => r.id}
showFormatBuilder conditionalFormats={rules} onConditionalFormatsChange={setRules} />
)
}
Loading live example…

Overview

Layershow* (chrome, resolved in the adapter)
Typeboolean
Defaultfalse
Maps toadapter toolbar "Formats" button + panel hosting BstConditionalFormatBuilder — end-users build conditionalFormats rules at runtime (uncontrolled local state, or controlled via the callback). Builder columns auto-derived from the grid's columns. Needs enableConditionalFormatting. In settings ("Display", always shown). shadcn: new format icon slot (palette)
Status✅ done
Sincev0.31.0
Settings sheetDisplay

Enable it

<BstTableMui
data={rows}
columns={columns}
enableConditionalFormatting // chrome is a no-op without its behaviour flag
showFormatBuilder
/>

Swap BstTableMui for BstTableShadcn (and the CSS import) for the shadcn skin — same props.

Options

OptionNotes
onConditionalFormatsChangeRelated prop for this feature.

Behavior & interactions

  • Requires enableConditionalFormatting to be on — this flag is a no-op otherwise.

Spec coverage

Spec codes (A1, C2, X8, …) are Bst-Table's internal requirement IDs from the capability matrix; P0P2 mark the delivery phase. They are traceability tags, not part of the public API.

  • K3 · Conditional formatting — ✅ built. v0.18.0 — rule engine + <BstConditionalFormatBuilder>