Change Proposal: Apply `DiamondDSIntegrations` MRT styling automatically to all tables, not just opted-in ones

Open
#280 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

Start with the TODO in src/themes/DiamondDSIntegrations.ts and inspect how useMaterialReactTable and MaterialReactTable are used. Compare the proposed hook or wrapper options, preserving manual mrtOptions()/mrtTheme usage and ensuring caller options override the DiamondDS defaults; done means MRT tables can consistently receive the styling through the new recommended path.

Written by the indexing model from the issue text.

Description

needs-triage

What is being proposed?

A wrapper or a component that pre-merges DiamondDSIntegrations.mrtTheme / mrtOptions() so every Material React Table instance in a consuming app picks up DiamondDS styling by default, instead of requiring each call site to use it individually.

Why is this needed?

#249 added DiamondDSIntegrations.mrtTheme / mrtOptions(), but they only apply if a developer remembers to use them into a given useMaterialReactTable call. If they don't, the table silently falls back to MRT's unstyled defaults, with no error or warning, so styling drifts table-by-table across an app instead of being guaranteed by the design system. This was flagged as a follow-up TODO directly in src/themes/DiamondDSIntegrations.ts.

What will change?

  • Behaviour: DiamondDS table styling becomes the default for MRT tables rather than opt-in per instance.
  • Component props or usage: likely a new hook/wrapper is introduced; existing manual mrtOptions()/mrtTheme spreading should keep working for anyone not yet migrated.
  • New component: possibly a thin wrapper around useMaterialReactTable or MaterialReactTable.

Interface changes (if any)

// wraps useMaterialReactTable and merges DiamondDS defaults automatically
const table = useDiamondMaterialReactTable({
  columns,
  data,
  // any options here still override the DiamondDS defaults
});

Breaking change?

  • Yes
  • No

Additive: existing code that manually uses mrtOptions()/mrtTheme continues to work; the new hook/wrapper is the recommended path going forward.

Dominant language
TypeScript
Stars
8
Forks
3
Avg merge
2d 6h
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DiamondLightSource/sci-react-ui

All issues in DiamondLightSource/sci-react-ui

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.