docs(layer-card): RFC for first-class composition of Secondary#472
Draft
mattrothenberg wants to merge 1 commit intomainfrom
Draft
docs(layer-card): RFC for first-class composition of Secondary#472mattrothenberg wants to merge 1 commit intomainfrom
mattrothenberg wants to merge 1 commit intomainfrom
Conversation
Adds a proposal page that surveys current LayerCard.Secondary usage and recommends three changes: a fixed 56px header height, Title/Actions sub-components for composition, and render-prop support for whole-area linkable headers. Prototype components are defined locally in the demo file and a 'required component tweaks' section calls out the small Tabs variant needed before this can fully ship. This page is intended as a design artifact for alignment, not a code change to LayerCard itself.
commit: |
Contributor
Docs PreviewCommit: |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

























































Summary
Proposal page for aligning teams on a recommended composition pattern for
LayerCard.Secondary. Not a code change toLayerCarditself — this is a design artifact.An audit of
LayerCard.Secondaryacross our largest consumer found ~360 usages across ~140 files. ~40 of those reimplementflex items-center justify-betweenwith two grouping<div>s by hand, plus a long tail of inline icons, tooltips, badges, switches, tabs, and pagination crammed into the same slot. Heights drift visibly across the product.Proposal (in three parts)
p-4withh-14 px-4onSecondary(56px). Vertical sizing comes fromh-14, not padding, so content variation can't change the strip height.LayerCard.TitleandLayerCard.Actionssub-components. Composition only — no slot props. JSX order = visual order.Actionsusesml-auto(nojustify-betweenparent toggle).renderonSecondaryfor the "whole header is a link" case. Already idiomatic in kumo (LayerCardroot,Tooltip, etc.). Hover/focus/cursor affordances activate via[&[href]]:attribute selectors baked into the base classes — automatic when consumers dorender={<a/>}, no-op otherwise.What this PR adds
packages/kumo-docs-astro/src/pages/components/layer-card-secondary.mdx— the proposal docpackages/kumo-docs-astro/src/components/demos/LayerCardSecondaryProposalDemo.tsx— 12 demos covering each archetype from the audit (label-only, title with icon/tooltip/badge, toggle card, toolbar with Tabs, toolbar withSelect size="sm"as the recommended alternative, linked header, footer, skeleton, height-consistency strip, anti-pattern)@cloudflare/kumo-docs-astroThe prototype
Title/Actions/render-awareSecondaryare defined locally in the demo file as a stand-in. They are not exported and the realLayerCardis unchanged.Required follow-up component tweaks
The 56px height invariant requires a few small changes elsewhere before it can ship for all use cases. Each is scoped and tracked separately:
Tabs— needs a small variant (~32px control height) to fit the Secondary strip. Today consumers override with[&_[role=tablist]]:h-9.Select— confirmsize="sm"is the documented choice forActions. Already fits today; this proposal uses it as the recommended alternative until smallTabslands.Pagination— variable height, currently used in ~6 footer-style Secondaries. Calibration needed.Why composition (not props)
Considered but rejected:
<LayerCard.Secondary title="…" icon={…} badge={…} actions={…} />. Every prop introduces a "what wins, prop or children?" broken state, and prop-shaped slots impose an order the consumer can't override. Composition answers all of that by construction.