Skip to content

Add PrimeReact's styled mode and the PrimeReact 10 palette - #148

Merged
einari merged 4 commits into
mainfrom
feature/styled-mode
Aug 17, 2026
Merged

Add PrimeReact's styled mode and the PrimeReact 10 palette#148
einari merged 4 commits into
mainfrom
feature/styled-mode

Conversation

@einari

@einari einari commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

PrimeReact 11's primereact package is unstyled primitives, so a @primeuix/themes preset handed to the provider emitted design tokens but styled nothing this library renders — every application that upgraded lost its look. Styled mode brings PrimeReact's own component styles to every primitive under the provider, painted by a preset that reproduces the lara-blue look Cratis applications had on PrimeReact 10, and the palette those applications' own CSS is written against comes back as a stylesheet.

Added

  • @cratis/components/styledstyledMode() configures the provider for PrimeReact 11's styled mode: primeReactStyles (PrimeReact's component styles for every primitive, applied through the provider's defaults) together with a @primeuix/themes preset, emitted into the primereact cascade layer so an application's own CSS overrides the theme as it did on PrimeReact 10. CratisPreset is Lara on the blue primary and gray surfaces of lara-light-blue / lara-dark-blue; any preset can be passed instead. @primereact/styles and @primeuix/themes are optional peers, needed only for this path.
  • @cratis/components/primereact-v10-palette — the --surface-*, --text-color, --primary-color, --highlight-*, --focus-ring, --surface-0…900, --primary-* and color-scale variables PrimeReact 10's themes published, with the lara-blue values in both schemes, so CSS written against them keeps resolving.
  • Message renders the severity glyph PrimeReact 10 showed; an icon prop replaces or removes it.

Changed

  • Dropdown reads label / value off option objects when no optionLabel / optionValue is given, as PrimeReact 10's Dropdown did, and renders the trigger chevron and clear glyph again.
  • Table column headers render through PrimeReact's title part, so a theme's column-title weight applies, and the empty-message row is padded and bordered like a data row.
  • --cratis-surface-0 and --cratis-surface-100 resolve from PrimeReact 11's form-field and hover surface tokens rather than --p-surface-0/100, which are white in both color schemes.

Fixed

  • The Cratis baseline theme positions the dialog backdrop and centers the dialog; both rendered in normal flow below the page content.

🤖 Generated with Claude Code

einari and others added 4 commits August 17, 2026 07:37
PrimeReact 11's `primereact` package is unstyled primitives: a preset on
the provider emits design tokens, but the primitives render without any
`p-*` class, so nothing this library builds on them ever picked up the
look a `@primeuix/themes` preset was meant to give. PrimeReact's own
styled components are those primitives with their `styles` prop preset
from `@primereact/styles`, and the provider accepts default props per
component name - which is all the gluing there is.

`@cratis/components/styled` does that gluing for every primitive at
once. `primeReactStyles` maps each primitive's root to its PrimeReact
styles (and the animating parts to their motion names), `CratisPreset`
is Lara on the blue primary and gray surfaces of the lara-blue themes
Cratis applications ran on PrimeReact 10, and `styledMode()` combines
the two for the provider's `value`, emitting the theme into the
`primereact` cascade layer between Tailwind's base and components layers
so an application's own CSS overrides it exactly as it did with v10's
`@layer primereact` stylesheets and its utilities still win.

`@cratis/components/primereact-v10-palette` restores the `--surface-*`,
`--text-color`, `--primary-color` and color-scale names v10's themes
published, with the lara-blue values, so CSS written against them keeps
resolving; the semantic names follow the active preset. The two surface
tokens v11 has no scale for, `--cratis-surface-0` and `-100`, now read
v11's form-field and hover surfaces instead of `--p-surface-0/100`,
which are white in both schemes.

`@primereact/styles` and `@primeuix/themes` are optional peers: only the
styled entry imports them, and it is built as its own bundle so the root
export stays free of them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…forward

The v11 primitives leave to the composer what v10 rendered on its own:

- `Dropdown` shows `option.label` and compares `option.value` when no
  `optionLabel` / `optionValue` is given, as v10's Dropdown did - v11's
  Select compared the option object itself against the value, so
  `[{ label, value }]` options showed the raw value in the trigger. The
  trigger also carries the chevron (through the Indicator part, not the
  popup's Arrow) and a clear glyph again.
- `Message` renders the severity glyph v10 showed - info-circle, check,
  exclamation-triangle, times-circle - with an `icon` prop to replace or
  drop it.
- Column headers render through the DataTable title part, so a theme's
  column-title weight reaches them, and the empty-message body carries
  the tbody class so a theme's cell rules pad and border it like a row.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PrimeReact 11 renders the backdrop and the positioner as siblings under
the portal and leaves placing them to CSS. The baseline theme styled the
popup but not those two, so the backdrop was a zero-height block and the
dialog flowed in after the page content, below the fold. Pin both to the
viewport and center the popup, as PrimeReact's own dialog style does.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A preset alone was documented as what styles the components; it never
did on the primitives this library builds on. The styling guides,
migration guide, README and provider docs now describe styled mode -
`styledMode()`, `CratisPreset`, `primeReactStyles`, the cascade layer -
next to the baseline theme and unstyled paths, the palette that carries
a v10 stylesheet's variables forward, and the Dropdown label/value
convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@einari einari added the minor label Aug 17, 2026
@einari
einari merged commit 17f10cb into main Aug 17, 2026
8 checks passed
@einari
einari deleted the feature/styled-mode branch August 17, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant