Skip to content

feat(F0Button): show a counter on buttons, styled right - #5225

Merged
AngelMsaa merged 11 commits into
mainfrom
feat/collection-secondary-action-counter
Aug 28, 2026
Merged

feat(F0Button): show a counter on buttons, styled right#5225
AngelMsaa merged 11 commits into
mainfrom
feat/collection-secondary-action-counter

Conversation

@AngelMsaa

@AngelMsaa AngelMsaa commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What

Makes the button's counter pill look right: a neutral grey count next to the label, spaced and centered, and dark on the primary variant so it doesn't wash out.

  • Neutral default (grey) counter instead of the selected teal — it reads as a count, not a toggled state. No prop to pick another type.
  • 4px gap before it, vertically centered in the button height.
  • On the default (primary) variant — a solid dark-red field — the counter renders as a dark pill (dark theme scoped to just the counter), regardless of the app's light/dark theme.
image

Note

Touches the shared F0Button, so it also restyles the OneFilterPicker applied-filters counter (the only other caller) from teal to grey.

Letting a OneDataCollection secondary action actually request a counter is the paired PR #5249.

@github-actions github-actions Bot added feat react Changes affect packages/react labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🔍 Review policy: Feature

The PR title starts with feat, so this is a feature: it needs one approval from f0-devs AND one from f0-designers (rule 3).

Required approvals

Team Why Status
@factorialco/f0-devs Features need a dev approval ✅ approved by @sauldom102
@factorialco/f0-designers Features need a design approval ✅ approved by @desiree-np
How this was decided
  • PRs touching only sds/ modules require their owners and nothing else.
  • Otherwise, docs-only changes (*.md, *.mdx, *.stories.tsx, anything in __stories__/) → one f0-general approval.
  • Otherwise, feat: titles → one f0-devs and one f0-designers approval. Not a feature? Fix the title prefix.
  • Anything else → one f0-devs approval.
  • Add the needs-design-review label to also request a design approval on any PR.
  • Creating a new sds/ module (new package.yml) additionally requires an f0-general approval.

Policy source: ownership/review-policy.ts · Team members: ownership/teams.yml

@github-actions

Copy link
Copy Markdown
Contributor

✅ No New Circular Dependencies

No new circular dependencies detected. Current count: 0

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🔍 Visual review for your branch is published 🔍

Here are the links to:

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

📦 Alpha Package Version Published

Use pnpm i github:factorialco/f0#npm/alpha-pr-5225 to install the package

Use pnpm i github:factorialco/f0#76f100563131b4b6507c476e7316706602f8bfc8 to install this specific commit

@github-actions

Copy link
Copy Markdown
Contributor

✅ No breaking public API changes

No public exports were removed, renamed, or had existing props/types changed in a breaking way compared to main.

Comparing f0, experimental and ai against main. Adding components, types, or optional props is safe. This check is non-blocking.

⚠️ Could not analyze component-status (no-base) — a build may have failed; results may be incomplete.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

♿ Accessibility (axe) — components changed in this PR

✅ No a11y issues in the stories this PR changed.

Scope: only stories in the files/component folders this PR changed. It can't yet flag downstream ripple from shared-code/token changes, or diff against main (planned: base-vs-head delta).

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/react

Status Category Percentage Covered / Total
🔵 Lines 69.2% 29427 / 42519
🔵 Statements 68.14% 31141 / 45697
🔵 Functions 61.99% 7036 / 11350
🔵 Branches 61.92% 22070 / 35638
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/react/src/components/F0Button/internal-types.ts 100% 100% 100% 100%
packages/react/src/components/F0Button/internal.tsx 100% 85.54% 100% 100%
Generated in workflow #17635 for commit 6e891e4 by the Vitest Coverage Report Action

The button's counter was the "selected" (teal) type, which reads as a toggled
state rather than a plain count. A count next to a label is neutral
information, so it now uses the default grey counter, with no way to pick the
louder selected or bold types.

Note: this also restyles the OneFilterPicker applied-filters counter, the only
other caller, from teal to grey.
The margin wrapper was a block line-box taller than the counter, so the pill
sat about a pixel below center. Shrinking the wrapper to the counter with
inline-flex lets the button's items-center place it exactly.
The default (primary) button is a solid dark-red field where the light grey
counter washes out. Scoping the dark theme to just the counter on that variant
gives it a dark pill with light text, for contrast, regardless of the app's
current theme.
@AngelMsaa
AngelMsaa force-pushed the feat/collection-secondary-action-counter branch from b62d99b to ff1f2fd Compare August 26, 2026 07:48
@AngelMsaa AngelMsaa changed the title feat(OneDataCollection): support a counter on secondary actions feat(F0Button): counter styling (neutral pill, spacing, primary-variant dark) Aug 26, 2026
@AngelMsaa AngelMsaa changed the title feat(F0Button): counter styling (neutral pill, spacing, primary-variant dark) feat(F0Button): show a counter on buttons, styled right Aug 26, 2026

@sauldom102 sauldom102 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Doesn't look a bit wrong in sm? 🤔

Image

Per the Figma "ButtonCounter" spec, a button with a trailing counter drops 4px
of right padding at every size (sm 8→4, md 12→8, lg 16→12); the left padding
is unchanged, and buttons without a counter keep their symmetric padding.
@github-actions

Copy link
Copy Markdown
Contributor

✅ No untranslated copy added

Every user-visible string in this PR comes from the i18n layer. Codebase total unchanged at 133.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

✅ Storybook docs — no pages lost

Every page reachable on main is still reachable here.

✏️ 10 updated

✏️ Updated — 10 page(s)/story/stories across 2 file(s)

The source file behind each of these changed. Detection is per file, so editing one story flags its siblings too.

🔇 Added but not in the sidebar — 1

Expected for snapshot-only and internal stories (no-sidebar / !dev). Listed in case one was meant to be visible.

  • Components/Button/Button › Counterstable

Links point at this PR's Storybook build — browse the full Storybook.

Snapshot of the Storybook index (docs pages + stories) compared against main. Non-blocking.

@AngelMsaa

AngelMsaa commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Doesn't look a bit wrong in sm? 🤔

Image

Fixed:

image

…riants

- The counter now tracks the button height: 20px on md/lg, 16px on sm.
- A count of 0 (or no value) renders nothing — no stray "0", no pill, and the
  right-padding tightening no longer fires for an absent counter.
- The dark pill now covers every solid colour field (default, critical,
  promote), so the counter stays legible on critical, not just primary.
- Documents the counter behaviour in a Storybook story.
- The counter darkens only where a light pill would wash out: always on the
  primary field, on critical only while hovered. Promote and the other
  variants keep the neutral counter.
- The docs page gains a Counter section under Sizes — a preview of every
  variant with a counter, and guidance on what it is for and how it adapts.
@AngelMsaa
AngelMsaa merged commit 2075450 into main Aug 28, 2026
55 of 56 checks passed
@AngelMsaa
AngelMsaa deleted the feat/collection-secondary-action-counter branch August 28, 2026 12:42
@eliseo-juan eliseo-juan mentioned this pull request Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat react Changes affect packages/react

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants