Skip to content

@vibe-labs/design-forms

Form reset, input/button tokens, and sizing utilities for the Vibe Design System.

Installation

css
@import "@vibe-labs/design-forms";

Tokens

Form Reset (@layer vibe.reset)

Opinionated form normalization including:

  • Universal box-sizing: border-box and tap highlight removal
  • font: inherit on all form elements with appearance reset
  • cursor: pointer on buttons, cursor: not-allowed + opacity on disabled elements
  • Placeholder color normalization
  • Number input spinner removal
  • Search input clear button removal
  • Vertical-only textarea resize

Input Sizing (@layer vibe.tokens)

Tokensmmdlg
--input-height-{size}2rem2.5rem3rem
--input-px-{size}--space-2--space-3--space-4

Input Appearance (@layer vibe.tokens)

TokenDefaultDescription
--input-radius--radius-mdBorder radius
--input-border-width--border-width-1Border width
--input-border--border-subtleDefault border color
--input-border-hover--border-strongHover border color
--input-border-focus--color-accentFocus border color
--input-bg--surface-elevatedBackground
--input-text--text-primaryText color
--input-placeholder--text-mutedPlaceholder color
--input-disabled-opacity0.5Disabled state opacity
--input-focus-ring-width2pxFocus ring width
--input-focus-ring-color--color-accentFocus ring color

Button Sizing (@layer vibe.tokens)

Tokensmmdlg
--btn-height-{size}2rem2.5rem3rem
--btn-px-{size}--space-3--space-4--space-6
--btn-font-size-{size}--text-xs--text-base--text-md

Button Appearance (@layer vibe.tokens)

TokenDefault
--btn-radius--radius-md
--btn-font-weight--font-semibold (600)

Select (@layer vibe.tokens)

TokenDefault
--select-indicator-size1rem
--select-indicator-color--text-muted

Utilities / Generated Classes

Utility classes generated into @layer vibe.utilities via the build script.

Input Sizing

.input-sm · .input-md · .input-lg — sets height and horizontal padding

Button Sizing

.btn-sm · .btn-md · .btn-lg — sets height, horizontal padding, and font size

Dist Structure

FileDescription
index.cssBarrel — imports both files below
forms.cssForm reset + token definitions
forms.g.cssGenerated sizing utilities

Dependencies

References tokens from spacing (--space-*), borders (--radius-*, --border-width-*, --border-*), colors (--color-accent), surfaces (--surface-*), and typography (--text-*, --font-*) packages.

Build

bash
npm run build

Usage Guide

Provides form reset, input/button sizing tokens, and sizing utility classes for consistent form element treatment in the Vibe Design System.

Import

css
@import "@vibe-labs/design-forms";

Common Patterns

1. Sized input field

html
<input
  class="input-md rounded-md border border-default bg-elevated text-primary"
  type="text"
  placeholder="Enter value..."
/>

2. Three button sizes side by side

html
<button class="btn-sm bg-elevated rounded-md">Small</button>
<button class="btn-md bg-accent rounded-md">Default</button>
<button class="btn-lg bg-accent rounded-md font-semibold">Large</button>
html
<form class="flex gap-2">
  <input class="input-sm flex-1 rounded-md border border-default" type="search" />
  <button class="btn-sm bg-accent rounded-md">Search</button>
</form>

4. Override input appearance tokens for a custom theme

css
:root {
  --input-bg: var(--color-neutral-800);
  --input-border: var(--color-neutral-600);
  --input-border-focus: var(--color-blue-400);
  --input-radius: var(--radius-lg);
}

5. Inline form row (label + input + button)

html
<div class="flex items-center gap-3">
  <label class="text-sm font-medium" for="email">Email</label>
  <input
    id="email"
    class="input-md flex-1 rounded-md border border-default"
    type="email"
  />
  <button class="btn-md bg-accent rounded-md">Subscribe</button>
</div>

6. Disabled field state

The reset applies cursor: not-allowed and reduced opacity automatically to [disabled] elements. No extra class needed:

html
<input class="input-md rounded-md border border-default" disabled value="Read only" />

Token Reference

TokenDefaultOverridable
--input-height-sm/md/lg2rem / 2.5rem / 3remYes
--input-bg--surface-elevatedYes
--input-border--border-subtleYes
--input-border-focus--color-accentYes
--input-radius--radius-mdYes
--btn-height-sm/md/lg2rem / 2.5rem / 3remYes
--btn-font-weight600 (semibold)Yes
--btn-radius--radius-mdYes

Vibe