Skip to content

feat(components): add SegmentDensity (Regular/Compact) to SegmentedContent#30

Merged
maniramezan merged 2 commits into
mainfrom
feat/segment-density
Jun 6, 2026
Merged

feat(components): add SegmentDensity (Regular/Compact) to SegmentedContent#30
maniramezan merged 2 commits into
mainfrom
feat/segment-density

Conversation

@maniramezan
Copy link
Copy Markdown
Owner

@maniramezan maniramezan commented Jun 6, 2026

Adds a density preset to SegmentedContent, mirroring SegmentDensity added to SwiftUIComponents' SegmentedPicker (iOS/Android parity).

What

enum class SegmentDensity { Regular, Compact }
SegmentedContent(items = …, density = SegmentDensity.Compact, …)
  • Regular (default) — unchanged: 48dp minimum touch target.
  • Compact — segment height floor drops to ~32dp (spacing.x4) and the title's vertical padding halves, matching a native compact segmented control.

Threaded through both public overloads → SegmentBar → even/intrinsic/scrollable rows → SegmentSlot. New param defaults to Regular, so existing callers are unaffected (source-compatible).

Showcase & sample

  • New SegmentedContentCompactPreview (@PreviewLightDark) + matching Showkase entry.
  • Sample app's SegmentedContent page gains a Density control (Regular/Compact) so it's demonstrated in the catalog/sample.

Tradeoff (documented on the enum)

At Compact the tap target shrinks with the control (below the 48dp guideline) — use where a tighter control matters more than a generous tap area.

Verification

:components and :sample compile, ktlint, detekt all pass; :catalog:assembleDebug succeeds; :components:testDebugUnitTest passes.

Follow-up (after release)

Bump the Android app's composeUiLib and set density = SegmentDensity.Compact on the video-details segview header (parity with the iOS change already on main).

…ntent

Compact reduces the segment title's vertical padding (half) and the height
floor to ~32dp (spacing.x4) instead of the 48dp minimum touch target,
matching a native compact segmented control. Default Regular preserves
current sizing. Threaded through both public overloads, SegmentBar, the
even/intrinsic/scrollable rows, and SegmentSlot. The tap target shrinks
with the control in compact, documented on the enum.

Mirrors SegmentDensity added to SwiftUIComponents' SegmentedPicker.
Add a SegmentedContentCompactPreview (+ Showkase entry) and a Density
control (Regular/Compact) on the sample app's SegmentedContent page.
@maniramezan maniramezan merged commit 310cf17 into main Jun 6, 2026
2 checks passed
@maniramezan maniramezan deleted the feat/segment-density branch June 6, 2026 18:07
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.

1 participant