SenUI Logo

A quiet yes or no, with the label always visible.

SenCheckbox stays out of the way — a native input, a required label, an optional description, and a forwarded ref so it slots into any form library without ceremony.

One short email per release, never more.

One choice at a time, made obvious.

Controlled

Track the value yourself — the checkbox is a thin wrapper over the native input, so React state owns the truth.

Current value: false

React Hook Form

Drop into a Controller. The checked boolean flows out cleanly via onChange.

Disabled

Stay visible without inviting interaction.

With description

Surface the consequence without hiding it in a tooltip.

Removes saved data from this device.

Group

Stack independent toggles. For one-of-many, reach for SenRadio.

Required label

Every checkbox carries a visible label so screen readers and humans agree on intent.

Optional description

Add a quiet subtitle when the choice has consequences worth surfacing.

Form-friendly

forwardRef and native input props mean React Hook Form, Formik, or plain forms all work.

Quick usage

A controlled checkbox with description — the most common shape in real product forms.

'use client'

import { useState } from 'react'
import { SenCheckbox } from 'sen-ui'

export function NotificationToggle() {
  const [enabled, setEnabled] = useState(false)

  return (
    <SenCheckbox
      label="Enable notifications"
      description="We'll only ping you about meaningful events."
      checked={enabled}
      onChange={(e) => setEnabled(e.target.checked)}
    />
  )
}

Full standalone implementation

import React, { forwardRef } from 'react'
import type { InputHTMLAttributes } from 'react'

export interface SenCheckboxProps
  extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
  id?: string
  label: string
  description?: string
  disabled?: boolean
  className?: string
}

export const SenCheckbox = forwardRef<HTMLInputElement, SenCheckboxProps>(
  ({ id, name, label, description, disabled = false, className, ...props }, ref) => {
    const _id = id ?? name

    return (
      <div className={['flex items-start space-x-2', className].filter(Boolean).join(' ')}>
        <input
          ref={ref}
          id={_id}
          name={name}
          type="checkbox"
          disabled={disabled}
          aria-describedby={description ? `${_id}-desc` : undefined}
          className={[
            'h-4 w-4 rounded border-gray-300 text-blue-600',
            'focus:ring-2 focus:ring-blue-500 focus:outline-none',
            disabled && 'cursor-not-allowed opacity-50',
          ].filter(Boolean).join(' ')}
          {...props}
        />
        <div className="flex flex-col">
          <label
            htmlFor={_id}
            className={[
              'font-medium select-none',
              disabled ? 'text-gray-500' : 'text-gray-900',
            ].join(' ')}
          >
            {label}
          </label>
          {description && (
            <p id={`${_id}-desc`} className="text-sm text-gray-500">
              {description}
            </p>
          )}
        </div>
      </div>
    )
  }
)

SenCheckbox.displayName = 'SenCheckbox'