Skip to content
civilian.
LibrarySetupAgent skill
…

Library
ComponentFreeSlime

Slime switch

A Radix switch with a liquid surface and four color presets.

Color presets

Green

On
Hugged · Full slimeMotion enabled

Blue

On
Hugged · Full slimeMotion enabled

Pink

On
Hugged · Full slimeMotion enabled

Purple

On
Hugged · Full slimeMotion enabled

Source and registry are built locally. Copy setup installs from this preview’s registry; the public release has not been published.

Install

In a React project configured with shadcn/Radix, this command copies the component and its required stylesheet. Use the preview’s running URL until the public registry release is published.

Install Slime switch
npx shadcn@latest add https://civilian.studio/r/slime-switch.json

Label layouts

Compact controls or full-width settings rows. Supporting text is optional. Enable it in Controls to preview the spacing below the drips.

Hugged

Label and switch stay together. Fits toolbars and compact panels.

Stretched

The row fills its container. Fits preferences and settings lists.

Disabled

Dried, matte slime with retracted drips and a locked thumb. The saved value remains visible.

Unavailable. Saved preference is on.
Unavailable. Saved preference is off.

State response

Off keeps a muted, glossy surface with short attached drips. On restores the saturated palette and expands the liquid motion. Disabled dries the material without changing the saved state.

Focus and input

Tab or Shift+Tab to an enabled switch to see its focus ring. Space or Enter toggles it. Fine-pointer hover lifts the thumb highlight; pressing compresses it. Touch uses the full 44px hit area.

Labels and state

Use a visible setting label that stays the same when toggled. Optional On / Off text is decorative; Radix announces the checked state to assistive technology.

Release status

Reusable source, registry packaging, and interaction checks are part of this local build. Manual screen-reader review and live publication verification remain release checks.

API reference

SlimeSwitch styles Radix Root and Thumb. SlimeSwitchField adds a visible label, description, and layout.

Controlled switch
"use client"

import { useState } from "react"
import { SlimeSwitchField } from "@/components/ui/slime-switch"

export function MemorySetting() {
  const [enabled, setEnabled] = useState(true)
  return (
    <SlimeSwitchField
      label="Agent Slop"
      checked={enabled}
      onCheckedChange={setEnabled}
    />
  )
}
Uncontrolled switch
"use client"

import { SlimeSwitchField } from "@/components/ui/slime-switch"

export function MemorySetting() {
  return (
    <SlimeSwitchField
      label="Agent Slop"
      defaultChecked
      name="memory"
      value="enabled"
    />
  )
}
SlimeSwitch · behavior
PropType / defaultDescription
checkedbooleanDefault: —Controlled state: the parent owns the value. Pair with onCheckedChange; do not also set defaultChecked.
defaultCheckedbooleanDefault: falseInitial uncontrolled state: Radix owns the value and onCheckedChange can observe changes.
onCheckedChange(checked: boolean) => voidDefault: —Called with the next state immediately, without waiting for the animation.
disabledbooleanDefault: falseBlocks interaction, removes keyboard focus, and dries the material. Preserves the saved value.
requiredbooleanDefault: falseNative form validation requires the switch to be checked.
namestringDefault: —Form field name. Only checked, enabled switches submit a value.
valuestring | number | readonly string[]Default: "on"Native button value type inherited from Radix. Use a string for the checked form value.
formstringDefault: —ID of a form to associate with, including a form outside the component.
SlimeSwitch · material
PropType / defaultDescription
slimeColor"green" | "blue" | "pink" | "purple"Default: "green"Material palette. Disabled uses a shared neutral dried surface.
treatment"slime" | "subtle"Default: "slime"Full liquid silhouette or restrained material.
animatebooleanDefault: trueContinuous ooze. Disabled, reduced-motion preferences, hidden tabs, and offscreen visibility take precedence.
stateText{ checked: string; unchecked: string }Default: —Optional engraved state text. Decorative; keep it short, around three characters. Longer text clips.
SlimeSwitchField · composition
PropType / defaultDescription
labelstringDefault: RequiredVisible, clickable accessible name. Keep it stable when the state changes.
descriptionReactNodeDefault: —Optional text below the drip clearance. Omitted by default; associated with aria-describedby.
layout"hugged" | "stretched"Default: "hugged"Keep label and switch together, or fill the container with the switch at the end.
fieldClassNamestringDefault: —Style the surrounding field. className still applies to the switch button.

Field accepts the switch’s behavior, material, native props and ref, except aria-label and aria-labelledby: its visible label supplies the accessible name.

Native props · forwarded to the button
PropType / defaultDescription
idstringDefault: Generated by FieldButton ID. The primitive needs an external label association; Field generates one.
refReact.Ref<HTMLButtonElement>Default: —Ref to the interactive button; forwarded through Field.
className / stylestring / React.CSSPropertiesDefault: —Customize the switch and its material tokens.
aria-label / aria-labelledbystringDefault: —Available on SlimeSwitch. Field owns these attributes through its visible label.
aria-describedbystringDefault: —Space-separated description IDs. Field merges them with its own description.
Native button attributes and eventsInherited from Radix RootDefault: Radix defaultsIncludes dir, title, tabIndex, type, data attributes, onClick, onKeyDown and focus/pointer events. Consumer preventDefault cancellation is respected. Radix sets type=button by default.

Radix differences

Radix Root supports asChild and custom children. Slime excludes both because it owns the liquid surface and Thumb. There is no separate public Thumb or unstable Radix parts API. See the Radix Switch reference.

Keyboard and forms

Tab and Shift+Tab move between enabled controls; disabled switches are skipped. Space or Enter toggles the focused switch. Safari follows the platform keyboard-navigation setting; Option+Tab also reaches controls. Radix supplies role=switch and aria-checked. Its hidden input handles form submission and validation. A checked disabled switch keeps its displayed value but does not submit it.

Styling hooks

The button exposes data-slot=switch, data-state, data-disabled, data-treatment, data-slime-color and data-animate. Field exposes data-slot=slime-switch-field, data-layout and data-disabled; its parts use slime-switch-row, slime-switch-label and slime-switch-description slots.

Material tokens

Override --slime-light, --slime-mid, --slime-dark, --slime-ink and --slime-glint using style or className. --slime-focus customizes the keyboard outline. --slime-control-edge sets the gradient thumb rim’s shaded color; --slime-state-ink sets decorative text. Set --slime-label-font on the field or an ancestor to customize rounded field and state typography. --slime-description-gap controls clearance below drips. Disabled uses a shared matte palette. Direction follows native dir, including RTL.

LibrarySetupAgent skillTerms© 2026
civilian.