Checkbox

Touch Checkbox

A large checkbox for phones: a 1.5rem box in a 2.75rem row — a target you hit with a thumb without aiming.

  • checkbox
  • mobile
  • touch
  • form

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/checkbox-008?lang=en

Show the full instructions

What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.

# Install and place "checkbox-008" (Touch Checkbox) from VibeUI

## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/checkbox-008.json

Registry item: https://vibeui.ru/r/checkbox-008.json
Installs to: components/vibeui/checkbox-008.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.

Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.

## 2. What it is
A large checkbox for phones: a 1.5rem box in a 2.75rem row — a target you hit with a thumb without aiming.

A large checkbox with a label and a hint: a thumb-sized target, a linked description and a disabled state. Zero dependencies, one file.

## 3. How to use it
import { Checkbox008 } from "@/components/vibeui/checkbox-008"

<Checkbox008 label="Save this card" hint="The number stays with the bank" onChange={setSave} />

Read the installed file for the full prop list.

## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.

Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)

## 5. Keep exactly as installed
- the local --vibeui-checkbox-008-* palette — do not swap it for your theme tokens
- the target size: a 2.75rem row with a 1.5rem box is the thumb minimum
- aria-describedby on the hint: without it the text is merely adjacent
- sizes in rem: they scale with the system settings
- the hover highlight — the target shows before the tap
- dimming the whole row when disabled, not just the box

## 6. You may change
- label and hint
- defaultChecked and disabled
- the onChange handler
- the accent through the accent prop

## 7. Rules
- The hint is not for terms: long text under a checkbox goes unread.
- A disabled checkbox needs an explanation beside it, or the block is a mystery.
- For document consent use checkbox-005 — it has the link and the error.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.

## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.

For developers

npx shadcn@latest add https://vibeui.ru/r/checkbox-008.json
https://vibeui.ru/r/checkbox-008.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-checkbox-008-*. Клиентский: "use client". Отметка нарисована через appearance: none и псевдоэлемент, размер задан в rem и масштабируется с настройками системы. Подсказка связана с полем через aria-describedby, выключенное состояние гасит всю строку.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

"use client"

import { useId, useState } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Checkbox008Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children" | "onChange"
> & {
  label?: string
  hint?: string
  defaultChecked?: boolean
  disabled?: boolean
  onChange?: (checked: boolean) => void
  accent?: string
}

// Идея компонента: крупный чекбокс для телефона. Квадрат 1.5rem и строка
// высотой 2.75rem — это минимальная цель, в которую попадают пальцем без
// прицеливания. Подсказка под подписью связана с полем через
// aria-describedby: без связи она для скринридера просто соседний текст.
const STYLES = `
:where([data-vibeui-block="checkbox-008"]){
--vibeui-checkbox-008-bg:oklch(1 0 0);
--vibeui-checkbox-008-fg:oklch(0.22 0.014 265);
--vibeui-checkbox-008-muted:oklch(0.56 0.014 265);
--vibeui-checkbox-008-border:oklch(0.86 0.008 265);
--vibeui-checkbox-008-hover:oklch(0.97 0.003 265);
--vibeui-checkbox-008-accent:oklch(0.55 0.17 265);
--vibeui-checkbox-008-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="checkbox-008"]{
width:100%;max-width:20rem;box-sizing:border-box;
background:var(--vibeui-checkbox-008-bg);
border:1px solid var(--vibeui-checkbox-008-border);border-radius:0.875rem;
font-family:var(--vibeui-checkbox-008-font);color:var(--vibeui-checkbox-008-fg);
}
/* Строка высотой 2.75rem: минимальная цель, в которую попадают пальцем. */
[data-vibeui-block="checkbox-008"] label{
display:grid;grid-template-columns:auto 1fr;align-items:center;gap:0.25rem 0.75rem;
min-height:2.75rem;padding:0.625rem 0.875rem;
border-radius:inherit;cursor:pointer;
}
[data-vibeui-block="checkbox-008"] label:hover{background:var(--vibeui-checkbox-008-hover)}
[data-vibeui-block="checkbox-008"] label:has(input:disabled){cursor:not-allowed;opacity:.55}
[data-vibeui-block="checkbox-008"] label:has(input:disabled):hover{background:transparent}
[data-vibeui-block="checkbox-008"] input{
appearance:none;grid-row:span 2;flex:none;cursor:inherit;position:relative;
width:1.5rem;height:1.5rem;margin:0;box-sizing:border-box;
border:2px solid var(--vibeui-checkbox-008-border);border-radius:0.4375rem;
background:var(--vibeui-checkbox-008-bg);
transition:background-color .14s ease,border-color .14s ease;
}
[data-vibeui-block="checkbox-008"] input:checked{border-color:transparent;background:var(--vibeui-checkbox-008-accent)}
[data-vibeui-block="checkbox-008"] input:checked::after{
content:"";position:absolute;left:50%;top:50%;
width:0.375rem;height:0.6875rem;margin:-0.46875rem 0 0 -0.1875rem;
border-right:2.5px solid oklch(0.99 0.01 265);border-bottom:2.5px solid oklch(0.99 0.01 265);
transform:rotate(45deg);
}
[data-vibeui-block="checkbox-008"] input:focus-visible{outline:2px solid var(--vibeui-checkbox-008-accent);outline-offset:2px}
[data-vibeui-block="checkbox-008"] [data-part="label"]{font-size:0.9375rem;font-weight:600;line-height:1.3}
[data-vibeui-block="checkbox-008"] [data-part="hint"]{grid-column:2;font-size:0.8125rem;line-height:1.4;color:var(--vibeui-checkbox-008-muted)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="checkbox-008"] *{animation:none!important;transition:none!important}}
`

/**
 * Крупный чекбокс для телефона: цель под палец и связанная подсказка.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Checkbox008({
  label = "Сохранить карту для будущих покупок",
  hint = "Номер карты хранится у банка, мы получаем только токен",
  defaultChecked = false,
  disabled = false,
  onChange,
  accent,
  className,
  style,
  ...props
}: Checkbox008Props) {
  const id = useId()
  const [checked, setChecked] = useState(defaultChecked)

  const palette = {
    ...(accent ? { "--vibeui-checkbox-008-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-checkbox-008" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="checkbox-008"
        className={className}
        style={palette}
      >
        <label htmlFor={id}>
          <input
            id={id}
            type="checkbox"
            checked={checked}
            disabled={disabled}
            aria-describedby={hint ? `${id}-hint` : undefined}
            onChange={(event) => {
              setChecked(event.target.checked)
              onChange?.(event.target.checked)
            }}
          />
          <span data-part="label">{label}</span>
          {hint ? (
            <span data-part="hint" id={`${id}-hint`}>
              {hint}
            </span>
          ) : null}
        </label>
      </div>
    </>
  )
}