Skip to content

Neumorphic Toggle Switch

Pure CSS neumorphic toggle switches with inset shadow tracks, raised knobs and glowing indicators, built on accessible native checkboxes.

Also known as: soft ui toggle, neumorphism switch, on off toggle button, skeuomorphic toggle switch, checkbox switch inset shadow

Neumorphic Toggle Switch live demo

Open in new tab

Pure CSS code (HTML, CSS)

A set of soft UI toggle switches built with pure CSS and no JavaScript. Each switch uses inset shadows for the track and a raised knob with a small glowing indicator, giving the typical neumorphic look. It fits settings panels, smart home dashboards and preference screens.

How it works

The outer .nt-stage provides the light gray surface that neumorphism needs, because the effect relies on a light and a dark shadow on the same background color. Inside it, section.nt-panel holds a heading and a list of rows. Every row is a label.nt-switch containing the text (.nt-label and .nt-hint), a native checkbox .nt-input with role="switch", and the visual .nt-track with its .nt-knob.

The checkbox is visually hidden but stays in the accessibility tree and in the tab order. Clicking anywhere on the label toggles it. The track uses two inset box-shadow layers to look pressed into the surface. When the input is checked, the adjacent sibling selector .nt-input:checked + .nt-track slides the knob to the right with a transform and lights up the .nt-knob::after dot in the accent color with a soft glow. Pressing the switch briefly turns the knob shadow inward for a tactile feel. A disabled input dims the whole row through :has().

Customization

  • --nt-surface, --nt-light and --nt-shadow on .nt-stage: the base color and the two shadow tones. Keep them in the same hue family for a convincing soft UI.
  • --nt-on and --nt-on-glow: the color of the active indicator dot and the ring around a checked track.
  • .nt-switch--warm: a modifier that switches the accent to amber; copy it to create more color variants.
  • --nt-track-w and --nt-track-h: the size of the track; the knob size and travel distance are calculated from them.
  • --nt-gap: the space between the knob and the track edge.
  • --nt-speed: the duration of the knob slide and the glow transition.
  • Add the disabled attribute to any .nt-input to show a locked setting, as in the Auto sync row.

Use cases

  • Settings panels: each row has a label, hint and soft raised switch for turning options on or off
  • Smart home dashboards: glowing indicators show which devices or features are active
  • Preference screens: native checkboxes with switch roles submit with a form like any other field
  • Locked settings: a disabled switch dims its whole row to show an option cannot be changed

Accessibility

Each switch is a real checkbox with role="switch", so screen readers announce it as a switch with its on or off state, and the visible label text becomes its accessible name. The Space key toggles it and Tab moves between switches. A clear outline appears around the track on :focus-visible. Text colors are darker than typical neumorphic designs to keep the contrast readable. With prefers-reduced-motion: reduce the knob moves without animation.

Usage notes

Inside a form, give each .nt-input a name and it submits like any checkbox. Use matching unique id and for values when you add more rows or several panels on one page.

Neumorphic Toggle Switch at a glance

Framework
Pure CSS
Code
HTML, CSS
JavaScript
Not needed, CSS only
Dependencies
None
Layout
Responsive, works on mobile
Category
Toggles & Switches
License
Free for personal and commercial use

Questions about this template

Can I use the Neumorphic Toggle Switch code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear and add the CSS to your stylesheet. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. It is built with HTML and CSS only, so there is no JavaScript to load.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Neumorphic Toggle Switch – free Pure CSS toggle & switch template
Neumorphic Toggle Switch · free Pure CSS toggle & switch template

More Toggles & Switches

iOS Style Toggle Switch – free Pure CSS toggle & switch template

iOS Style Toggle Switch

Pure CSS iOS style toggle switches built on real checkboxes, in a grouped settings list with three sizes, five colors and a disabled state.

Settings Toggles with Description – free Tailwind CSS toggle & switch template

Settings Toggles with Description

Tailwind CSS settings panel with accessible switches, label descriptions, a locked required option, restore defaults and an auto-save status message.

Day/Night Toggle – free Pure CSS toggle & switch template

Day/Night Toggle

Animated pure CSS day and night toggle switch where the sun turns into a cratered moon, clouds drift away and stars appear.

Toggler Button Demos – free Bootstrap 6 toggle & switch template

Toggler Button Demos

Four Bootstrap 6 Toggler demos on a dark panel: a favorite heart, a read-more expander, a light/dark theme preview and a grid/list view switch, all with data attributes.

Settings Panel with Switches – free Bootstrap 6 toggle & switch template

Settings Panel with Switches

Bootstrap 6 notification settings panel with switches grouped in cards, master switches per group, a pause-all toggle, unsaved-change tracking and a simulated save.

Toggle Switches with Labels – free Bootstrap 6 toggle & switch template

Toggle Switches with Labels

Dark Bootstrap 6 settings panel with .switch toggles in three sizes, labels with descriptions, disabled states and a simulated auto-save status.