Skip to content

Add control scaling support with --k-scale token#109

Draft
developit wants to merge 1 commit intomainfrom
claude/investigate-radix-scale-uF5fg
Draft

Add control scaling support with --k-scale token#109
developit wants to merge 1 commit intomainfrom
claude/investigate-radix-scale-uF5fg

Conversation

@developit
Copy link
Copy Markdown
Owner

Summary

Introduces a new --k-scale CSS custom property that allows independent scaling of interactive control dimensions (buttons, inputs, checkboxes, switches, etc.) without affecting text size. This enables compact or spacious UI variants through a single multiplier token.

Key Changes

  • New CSS variables in src/variables.css:

    • --k-scale: Unitless multiplier (default: 1) for control dimensions
    • --k-size-sm, --k-size-md, --k-size-lg: Derived size tokens that incorporate the scale factor
  • Updated component styles to use scale-aware sizing:

    • Button (button/style.css): Heights now reference --k-size-sm/md/lg tokens
    • Input (input/style.css): Heights use derived size tokens
    • Switch (switch/style.css): All dimensions scaled with calc() expressions
    • Checkbox (checkbox/style.css): Width/height scaled independently
    • Radio (radio-group/style.css): Dimensions scaled with multiplier
    • Select, Color Picker, Tabs, Textarea, Dropdown Menu: Updated to use scale tokens
  • Documentation (docs/pages/theming.md): Added comprehensive guide explaining:

    • How --k-scale works as a unitless multiplier
    • Scoping scale to specific containers
    • Independence from font-size
    • Direct token override capability
  • Theme customizer (demo/src/theme-customizer.tsx): Integrated --k-scale output when scale differs from 1

Implementation Details

  • Scale is applied consistently across all interactive controls using either derived size tokens or direct calc() expressions
  • The approach maintains backward compatibility—default scale of 1 produces original dimensions
  • Scoping is supported via CSS cascade, allowing different scale values in different containers
  • Direct token overrides remain possible for fine-grained control

https://claude.ai/code/session_01UeEamizUgKrTfKTi44grHr

Introduce a unitless --k-scale CSS custom property that controls the
dimensions of interactive controls independently of font-size. Define
derived size tokens (--k-size-sm/md/lg) that bake in the multiplier,
so components reference semantic tokens instead of hardcoded rem values.

Scoping --k-scale to a container (e.g. .compact-sidebar { --k-scale: 0.85 })
scales only descendant controls without affecting text or the rest of the page.

https://claude.ai/code/session_01UeEamizUgKrTfKTi44grHr
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 6, 2026

Deploy Preview for kinu-sh ready!

Name Link
🔨 Latest commit b64f870
🔍 Latest deploy log https://app.netlify.com/projects/kinu-sh/deploys/69d439a1605a2b0008a97f2a
😎 Deploy Preview https://deploy-preview-109--kinu-sh.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

Size Change: +268 B (+0.88%)

Total Size: 30.7 kB

📦 View Changed
Filename Size Change
benchmarks/size/.tmp/few-components/bundle.css 2.71 kB +51 B (+1.92%)
benchmarks/size/.tmp/nearly-all-components/bundle.css 8.51 kB +84 B (+1%)
benchmarks/size/.tmp/one-component/bundle.css 1.44 kB +48 B (+3.44%)
dist/index.css 8.61 kB +85 B (+1%)
ℹ️ View Unchanged
Filename Size
benchmarks/size/.tmp/few-components/bundle.js 405 B
benchmarks/size/.tmp/nearly-all-components/bundle.js 3.18 kB
benchmarks/size/.tmp/one-component/bundle.js 333 B
dist/index.js 5.51 kB

compressed-size-action

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.

2 participants