Single-line description:
Responsive CSS Clamp Generator – Generate CSS with responsive clamp values per breakpoint for multiple elements, with live preview, copy, and clear controls.
Live Demo: Try it here
- Dynamic breakpoints – Add, remove, or update breakpoints easily.
- Element-based CSS – Manage multiple elements like
.hero-titleor#header. - Property management – Add CSS properties per element with numeric values and units.
- Responsive
clamp()– Automatically generates CSS usingclamp()for smooth scaling across breakpoints. - Live preview – View generated CSS in real-time per breakpoint.
- Per-breakpoint controls – Copy or clear CSS for each breakpoint individually.
- Reset functionality – Clear all elements and breakpoints with one click.
- Clone the repository:
git clone https://github.com/mrbannerbear/super-clamp.git- Install dependencies:
npm install
or
yarn- Run the development server:
npm run dev
or
yarn devOpen http://localhost:3000 in your browser.
- Click Add Element to create a new CSS selector.
- Add properties (e.g.,
font-size,margin-top) and set values per breakpoint. - Add or remove breakpoints dynamically as needed.
- Click Result to open the slide-over panel:
- Each breakpoint has its own section with CSS output.
- Use Copy to copy CSS for that breakpoint.
- Use Clear to clear values for a specific breakpoint.
- Click Clear All to reset the entire store.
- All breakpoints are stored in descending order.
- Missing values for a property at a breakpoint are ignored in that breakpoint's CSS.
- Adding a new breakpoint automatically inserts it in the correct descending order.
- Each element (e.g.,
.hero) has multiple properties (e.g.,font-size). - Properties store numeric values per breakpoint and a separate unit (e.g.,
px,rem).
- The tool uses the
clamp()formula for smooth scaling between breakpoints:
slope = (maxValue - minValue) / (maxBreakpoint - minBreakpoint) * 100
intercept = minValue - slope * minBreakpoint / 100
clampValue = clamp(minValue, slope * vw + intercept, maxValue)
- Only active properties (with values) are included in the generated CSS.
- For each breakpoint, only elements with active properties are included.
- Each breakpoint has its own section in the result panel for easier control.
- Copy or clear CSS per breakpoint without affecting others.
/components
ResultPanel.tsx # Slide-over UI panel for CSS results
/utils
generateCss.ts # Generates CSS per breakpoint
generateClamp.ts # Calculates clamp values for responsive scaling
/store
useStore.ts # Zustand store for elements, properties, breakpoints
/helpers
breakpoints.ts # Helper functions for sorting and managing breakpoints
Contributions are welcome!
- Submit bug reports or feature requests via Issues.
- Fork the repo and create pull requests for improvements.
MIT License