Skip to content

Toolbar: elevation + density as orthogonal axes#97

Merged
lifeiscontent merged 5 commits into
mainfrom
feat/toolbar-density
Jun 16, 2026
Merged

Toolbar: elevation + density as orthogonal axes#97
lifeiscontent merged 5 commits into
mainfrom
feat/toolbar-density

Conversation

@lifeiscontent

@lifeiscontent lifeiscontent commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

The toolbar's variant (floater / topbar / bottom-bar) was doing three jobs at once: it set the surface, derived the density, and named a placement. Two of its values (topbar, bottom-bar) rendered identically, and density was hard-derived from it through ToolbarDensityContext, which is what blocked Figma's flat "fixed + compact" bar (node 2842-3905): a non-floating surface that still wants the tight 24px floater density.

This splits variant into the two axes it was really expressing, each named for what it does:

  • elevation: raised draws its own card (border + shadow, hovers over content) vs flat (no surface, sits flush in a host bar). The old topbar/bottom-bar were visually identical, so they collapse into one flat.
  • density: compact (24px hit targets) vs comfortable (28px).

Both are required props, so the DENSITY_BY_VARIANT table and the override fallback both disappear. "Fixed + compact" stops being a special case, it's just elevation="flat" density="compact". Placement (where the bar lives on the page) is the consumer's concern, so it no longer rides on the component.

Also drops the now-dead defaultVariants on the internal item/dropdown recipes; density always arrives through context.

Breaking change

variant is removed:

  • variant="floater" becomes elevation="raised" density="compact"
  • variant="topbar" / variant="bottom-bar" become elevation="flat" density="comfortable"

For design review

This intentionally restructures Figma's single placement-based variant axis into two orthogonal axes. Putting it up so the surface/density matrix is visible against the designs, happy to pull it back toward the placement model if that's the preferred shape.

Stories

Elevations and Densities are args-driven single-axis showcases; FlatCompact demos the orthogonal combo against the Figma node; DensityDrivesControlSize is the browser wiring check.

The overflow "..." control from #59 is still deferred pending a UX decision.

Refs #59

Copilot AI review requested due to automatic review settings June 15, 2026 15:39
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

📚 Storybook preview: https://pr-97-propel-storybook.vamsi-906.workers.dev

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR decouples Toolbar hit-target density from placement by introducing an explicit density override prop, enabling combinations like Figma’s “fixed + compact” (a flat topbar with 24px targets) while preserving existing default behavior when density is omitted.

Changes:

  • Add optional density?: "compact" | "comfortable" to Toolbar, defaulting to DENSITY_BY_VARIANT[variant] when not provided.
  • Update inline docs/comments to clarify default density behavior and the override.
  • Add a FixedCompact Storybook story demonstrating variant="topbar" with density="compact".

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/propel/src/components/toolbar/index.tsx Adds density prop and uses it to override the variant-derived density passed via context.
packages/propel/src/components/toolbar/toolbar.stories.tsx Documents default density behavior and adds a FixedCompact story demonstrating the new override axis.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/propel/src/components/toolbar/toolbar.stories.tsx Outdated
@lifeiscontent lifeiscontent changed the title Toolbar: density as an explicit axis Toolbar: elevation + density as orthogonal axes Jun 16, 2026
@lifeiscontent lifeiscontent self-assigned this Jun 16, 2026
@lifeiscontent

lifeiscontent commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

The approval above was for the earlier version that added density as an explicit override. I've since reworked it into the shape we talked about: instead of layering a density override on top of variant, it splits variant (floater/topbar/bottom-bar, two of which rendered identically) into two separate required axes, elevation (raised card vs flat) and density (compact vs comfortable). That drops the DENSITY_BY_VARIANT derivation, and "fixed + compact" becomes just elevation="flat" density="compact".

It's a bigger, breaking change than what you approved, so I'd rather get a fresh look than ride the old approval. Re-requesting review.

Add an optional density prop to Toolbar that overrides the variant-derived
default. When omitted, density still falls back to DENSITY_BY_VARIANT[variant]
(floater -> compact, topbar/bottom-bar -> comfortable), so existing usage is
unchanged. This unblocks Figma's flat fixed + compact bar: a topbar forced to
compact (24px) without the floater surface.

Adds a FixedCompact story for that case.
Add a DensityOverride story that renders a flat topbar forced to
density="compact" and asserts its controls measure 24px (size-6) rather
than the comfortable 28px default -> the override is now covered.
Replace the placement-named `variant` (floater/topbar/bottom-bar) with two
axes named for what they actually express:

- `elevation`: `raised` draws its own card (border + shadow) so it hovers over
  content; `flat` draws no surface and sits flush in a host bar. topbar and
  bottom-bar rendered identically, so they fold into one `flat`.
- `density`: `compact` (24px hit targets) vs `comfortable` (28px).

Both are required props, so the variant->density derivation table and the
`density ?? ...` fallback are gone. "Fixed + compact" stops being a special
case — it's just `elevation="flat" density="compact"`. Placement is the
consumer's job, not the primitive's, so it no longer lives on the component.

Also drop the now-dead `defaultVariants` on the internal item/dropdown
recipes: density always arrives through context.

Breaking: `variant` is removed. floater -> elevation="raised" density="compact";
topbar/bottom-bar -> elevation="flat" density="comfortable".
Copilot AI review requested due to automatic review settings June 16, 2026 13:00
@lifeiscontent lifeiscontent force-pushed the feat/toolbar-density branch from 8b4fdba to 73e3e67 Compare June 16, 2026 13:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread packages/propel/src/components/toolbar/index.tsx Outdated
Comment thread packages/propel/src/patterns/comment.stories.tsx Outdated
Comment thread packages/propel/src/patterns/comment.stories.tsx Outdated
lifeiscontent and others added 2 commits June 17, 2026 00:21
Export ToolbarDensity for parity with ToolbarElevation so consumers can
reference the allowed density values.

The bottom-bar formatting toolbar (Figma 2842-3905) is the fixed + compact
bar, but it was rendered with density="comfortable". Set it to compact in
both the live story and the recipe source snippet.
Copilot AI review requested due to automatic review settings June 16, 2026 17:23
@lifeiscontent lifeiscontent enabled auto-merge (squash) June 16, 2026 17:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@lifeiscontent lifeiscontent merged commit b6f8330 into main Jun 16, 2026
3 checks passed
@lifeiscontent lifeiscontent deleted the feat/toolbar-density branch June 16, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants