Skip to content
Introducing StyloftCSS 0.1 / A small foundation for your next big idea. Meet the framework
Essentials

Forms

Real labels, native controls, helpful descriptions, and clear error states.

CSS only6 examplesKeyboard friendly HTML

Project details

A static form layout: fields are interactive; there is no submission endpoint.

Live preview
Tell us about your idea

Use the address you check most often.

View HTML / PlaygroundHTML source
example.htmlHTML
<fieldset class="demo-fieldset sl-stack demo-narrow">
  <legend class="sl-text-xl sl-bold">Tell us about your idea</legend>
  <div class="sl-field">
    <label class="sl-label" for="project-name">Project name</label
    ><input
      class="sl-input"
      id="project-name"
      name="project"
      placeholder="My next big idea"
    />
  </div>
  <div class="sl-field">
    <label class="sl-label" for="project-email">Email address</label
    ><input
      class="sl-input"
      id="project-email"
      type="email"
      autocomplete="email"
      aria-describedby="email-note"
      placeholder="you@example.com"
    />
    <p class="sl-help" id="email-note">Use the address you check most often.</p>
  </div>
  <div class="sl-field">
    <label class="sl-label" for="project-type">Project type</label
    ><select class="sl-input" id="project-type">
      <option>Personal website</option>
      <option>Documentation</option>
      <option>Design system</option>
    </select>
  </div>
  <label class="sl-check"><input type="checkbox" /> Include optional modules</label>
</fieldset>
HTML source · enable JavaScript for the playground33 lines · UTF-8

Helpful validation

Live preview

Enter a workspace name to continue.

View HTML / PlaygroundHTML source
example.htmlHTML
<div class="sl-stack demo-narrow">
  <div class="sl-field">
    <label class="sl-label" for="workspace">Workspace name</label
    ><input
      class="sl-input"
      id="workspace"
      aria-invalid="true"
      aria-describedby="workspace-error"
    />
    <p id="workspace-error" class="sl-error">Enter a workspace name to continue.</p>
  </div>
  <div class="sl-field">
    <label class="sl-label" for="notes">Anything else?</label
    ><textarea
      class="sl-input"
      id="notes"
      rows="3"
      placeholder="A few words about your project…"
    ></textarea>
  </div>
</div>
HTML source · enable JavaScript for the playground21 lines · UTF-8

Radio choices and a disabled control

Live preview
Choose a project style
View HTML / PlaygroundHTML source
example.htmlHTML
<fieldset class="demo-fieldset sl-stack">
  <legend class="sl-label">Choose a project style</legend>
  <label class="sl-check"
    ><input type="radio" name="style-demo" value="minimal" checked /> Minimal</label
  ><label class="sl-check"
    ><input type="radio" name="style-demo" value="expressive" /> Expressive</label
  >
  <div class="sl-field">
    <label for="disabled-plan" class="sl-label">Locked plan (example)</label
    ><input id="disabled-plan" class="sl-input" value="Starter" disabled />
  </div>
</fieldset>
HTML source · enable JavaScript for the playground12 lines · UTF-8

Responsive field row

Live preview
View HTML / PlaygroundHTML source
example.htmlHTML
<div class="sl-grid sl-md:cols-2 sl-gap-4">
  <div class="sl-field">
    <label class="sl-label" for="first-name-example">First name</label
    ><input id="first-name-example" class="sl-input" autocomplete="given-name" />
  </div>
  <div class="sl-field">
    <label class="sl-label" for="last-name-example">Last name</label
    ><input id="last-name-example" class="sl-input" autocomplete="family-name" />
  </div>
</div>
HTML source · enable JavaScript for the playground10 lines · UTF-8

Styled dropdown with grouped options

A native select with a clean trigger, themed options and an animated popup in supporting browsers. No search plugin is required.

Live preview
View HTML / PlaygroundHTML source
example.htmlHTML
<div class="sl-stack">
  <div class="sl-field">
    <label class="sl-label" for="select-library">Choose a module</label
    ><select class="sl-select" id="select-library">
      <option value="">Select a module…</option>
      <optgroup label="Essentials">
        <option value="core">Core framework</option>
        <option value="forms">Forms and selects</option>
      </optgroup>
      <optgroup label="Expression">
        <option value="motion">Motion</option>
        <option value="cursor">Cursor effects</option>
      </optgroup>
    </select>
  </div>
  <div class="sl-field">
    <label class="sl-label" for="select-unavailable">Unavailable module</label
    ><select class="sl-select" id="select-unavailable" disabled>
      <option>Coming soon</option>
    </select>
  </div>
</div>
HTML source · enable JavaScript for the playground22 lines · UTF-8

Multiple selection

Use Ctrl/Command to choose separate options or Shift for a range. Native multiple-selection behavior is preserved.

Live preview

Choose one or more modules with your keyboard or pointer.

View HTML / PlaygroundHTML source
example.htmlHTML
<div class="sl-field">
  <label class="sl-label" for="select-modules">Optional modules</label
  ><select
    class="sl-select"
    id="select-modules"
    multiple
    size="4"
    aria-describedby="select-modules-help"
  >
    <option value="motion">Motion</option>
    <option value="tables">Tables</option>
    <option value="editor">Editor styles</option>
    <option value="header">Headers</option>
  </select>
  <p class="sl-help" id="select-modules-help">
    Choose one or more modules with your keyboard or pointer.
  </p>
</div>
HTML source · enable JavaScript for the playground18 lines · UTF-8

Classes beginning with sl- come from StyloftCSS. Examples with demo- classes also use our optional demo extension CSS ↓. Load it after the core to reproduce those details.