Checkbox
A checkbox for a consent or a setting.
Inverted theme
Right to left
The order cannot be placed without it
<template> <NuiCheckbox v-model="agreed" description="The order cannot be placed without it" required> I agree to the delivery terms </NuiCheckbox></template><script setup lang="ts">import { ref } from 'vue';import { NuiCheckbox } from '@numior/kit';const agreed = ref(false);</script>Pass the text in the default slot or in label. The hint and the error work as on the Field page.
Installation
import { NuiCheckbox, NuiCheckboxGroup } from '@numior/kit';Usage
Change the size and the states of the checkbox.
Inverted theme
Right to left
<template> <NuiCheckbox>I accept the terms</NuiCheckbox></template>Examples
Pick several options
Pass the options to the group in options.
Inverted theme
Right to left
<template> <NuiCheckboxGroup v-model:values="enabled" :options="methods" label="Delivery methods" description="The customer picks one of them at checkout" /></template><script setup lang="ts">import { ref } from 'vue';import { NuiCheckboxGroup } from '@numior/kit';import { DELIVERIES } from './orders';const REQUIRED = 'courier';const enabled = ref([REQUIRED, 'pickup']);const methods = Object.entries(DELIVERIES).map(([value, label]) => ({ value, label, disabled: value === REQUIRED,}));</script>export type OrderStatus = 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled';export type Payment = 'card' | 'transfer' | 'cash';export type Delivery = 'courier' | 'pickup' | 'post';export interface OrderLine { readonly sku: string; readonly name: string; readonly quantity: number; readonly price: number;}export interface Order { readonly id: number; readonly date: string; readonly customer: string; readonly city: string; readonly status: OrderStatus; readonly payment: Payment; readonly delivery: Delivery; readonly manager: string; readonly total: number; readonly lines: readonly OrderLine[];}export const ORDER_STATUSES: Record<OrderStatus, string> = { pending: 'Awaiting payment', paid: 'Paid', shipped: 'Shipped', delivered: 'Delivered', cancelled: 'Canceled',};export const PAYMENTS: Record<Payment, string> = { card: 'Card', transfer: 'Bank transfer', cash: 'On delivery',};export const DELIVERIES: Record<Delivery, string> = { courier: 'Courier', pickup: 'Pickup', post: 'Mail',};export const orders: readonly Order[] = [ { id: 20401, date: '2026-09-16', customer: 'Peter Wolfe', city: 'Boston', status: 'delivered', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 307, lines: [ { sku: 'S-101', name: 'Oslo armchair', quantity: 1, price: 249 }, { sku: 'X-507', name: 'Linen pillow', quantity: 2, price: 29 }, ], }, { id: 20402, date: '2026-09-17', customer: 'Lena Ortiz', city: 'Chicago', status: 'delivered', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 138, lines: [{ sku: 'L-401', name: 'Nord table lamp', quantity: 2, price: 69 }], }, { id: 20403, date: '2026-09-18', customer: 'Tim Sayed', city: 'Denver', status: 'delivered', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 507, lines: [ { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, { sku: 'S-104', name: 'Bergen chair', quantity: 2, price: 89 }, ], }, { id: 20404, date: '2026-09-19', customer: 'Vera Lane', city: 'Boston', status: 'cancelled', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 180, lines: [{ sku: 'S-110', name: 'Loft stool', quantity: 4, price: 45 }], }, { id: 20405, date: '2026-09-20', customer: 'Glen Nash', city: 'Austin', status: 'delivered', payment: 'cash', delivery: 'post', manager: 'Maria Kim', total: 175, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 1, price: 59 }, { sku: 'X-507', name: 'Linen pillow', quantity: 4, price: 29 }, ], }, { id: 20406, date: '2026-09-21', customer: 'Evan Porter', city: 'Seattle', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 199, lines: [{ sku: 'H-301', name: 'Vik shelving unit', quantity: 1, price: 199 }], }, { id: 20407, date: '2026-09-22', customer: 'Mary Cooper', city: 'Portland', status: 'shipped', payment: 'transfer', delivery: 'post', manager: 'Maria Kim', total: 416, lines: [ { sku: 'L-408', name: 'Arc floor lamp', quantity: 1, price: 119 }, { sku: 'L-412', name: 'Sphere pendant', quantity: 3, price: 99 }, ], }, { id: 20408, date: '2026-09-23', customer: 'Paul Hawkins', city: 'Boston', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 368, lines: [ { sku: 'H-305', name: 'Fjord dresser', quantity: 1, price: 299 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], }, { id: 20409, date: '2026-09-24', customer: 'Olga Graham', city: 'Chicago', status: 'paid', payment: 'card', delivery: 'pickup', manager: 'Maria Kim', total: 139, lines: [{ sku: 'T-207', name: 'Tromso coffee table', quantity: 1, price: 139 }], }, { id: 20410, date: '2026-09-25', customer: 'Sam Ellis', city: 'Denver', status: 'paid', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 863, lines: [ { sku: 'S-104', name: 'Bergen chair', quantity: 6, price: 89 }, { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, ], }, { id: 20411, date: '2026-09-26', customer: 'Nina Hart', city: 'Austin', status: 'pending', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 498, lines: [{ sku: 'S-101', name: 'Oslo armchair', quantity: 2, price: 249 }], }, { id: 20412, date: '2026-09-27', customer: 'Alina Yusuf', city: 'Portland', status: 'pending', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 187, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 2, price: 59 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], },];The checked values come to v-model:values as an array. An option with disabled: true cannot be changed, and a checked one stays in the array.
Line the checkboxes up in a row
Set orientation="horizontal".
Inverted theme
Right to left
<template> <NuiCheckboxGroup v-model:values="days" :options="weekdays" label="Delivery days" orientation="horizontal" /></template><script setup lang="ts">import { ref } from 'vue';import { NuiCheckboxGroup, type NuiOption } from '@numior/kit';const days = ref(['mon', 'wed']);const weekdays: NuiOption[] = [ { value: 'mon', label: 'Mon' }, { value: 'tue', label: 'Tue' }, { value: 'wed', label: 'Wed' }, { value: 'thu', label: 'Thu' }, { value: 'fri', label: 'Fri' },];</script>Check part of a list
Turn on indeterminate when only some items are checked.
Inverted theme
Right to left
<template> <div class="flex flex-col gap-2"> <NuiCheckbox :model-value="all" :indeterminate="some" @update:model-value="toggleAll"> All categories </NuiCheckbox> <NuiCheckboxGroup v-model:values="selected" :options="options" class="ms-6" /> </div></template><script setup lang="ts">import { computed, ref } from 'vue';import { NuiCheckbox, NuiCheckboxGroup } from '@numior/kit';import { categories } from './products';const options = categories.map(({ value, label }) => ({ value, label }));const selected = ref(['furniture']);const all = computed(() => selected.value.length === options.length);const some = computed(() => selected.value.length > 0 && !all.value);const toggleAll = (checked: boolean): void => { selected.value = checked ? options.map((option) => option.value) : [];};</script>export interface Product { readonly sku: string; readonly name: string; readonly category: string; readonly price: number; readonly stock: number;}export interface Category { readonly value: string; readonly label: string; readonly children?: readonly Category[];}export const categories: readonly Category[] = [ { value: 'furniture', label: 'Furniture', children: [ { value: 'seating', label: 'Chairs' }, { value: 'tables', label: 'Tables' }, { value: 'storage', label: 'Storage' }, ], }, { value: 'lighting', label: 'Lighting', children: [ { value: 'lamps', label: 'Lamps' }, { value: 'pendants', label: 'Pendants' }, ], }, { value: 'textile', label: 'Textiles', children: [ { value: 'throws', label: 'Throws' }, { value: 'pillows', label: 'Pillows' }, ], },];export const products: readonly Product[] = [ { sku: 'S-101', name: 'Oslo armchair', category: 'seating', price: 249, stock: 12 }, { sku: 'S-104', name: 'Bergen chair', category: 'seating', price: 89, stock: 34 }, { sku: 'S-110', name: 'Loft stool', category: 'seating', price: 45, stock: 0 }, { sku: 'T-201', name: 'Malmo desk', category: 'tables', price: 329, stock: 7 }, { sku: 'T-207', name: 'Tromso coffee table', category: 'tables', price: 139, stock: 15 }, { sku: 'H-301', name: 'Vik shelving unit', category: 'storage', price: 199, stock: 9 }, { sku: 'H-305', name: 'Fjord dresser', category: 'storage', price: 299, stock: 4 }, { sku: 'L-401', name: 'Nord table lamp', category: 'lamps', price: 69, stock: 41 }, { sku: 'L-408', name: 'Arc floor lamp', category: 'lamps', price: 119, stock: 18 }, { sku: 'L-412', name: 'Sphere pendant', category: 'pendants', price: 99, stock: 22 }, { sku: 'X-501', name: 'Wool throw', category: 'throws', price: 59, stock: 56 }, { sku: 'X-507', name: 'Linen pillow', category: 'pillows', price: 29, stock: 80 },];Accessibility
The checkbox is a native <input type="checkbox">, so the keyboard and screen readers handle it as usual. The group is a <fieldset>, and its label is the <legend>.
Keys | Action | |
|---|---|---|
Space | Checks or unchecks the box. |
API
NuiCheckbox
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
indeterminate | boolean | false | Shows a dash instead of a check: some nested items are selected. A click clears it. | |
value | string | — | Value sent with the form when the box is checked. | |
id | string | — | Id of the control. Defaults to the one from NuiField or is generated automatically. | |
size | NuiSize | "md" | Changes the size of the control: sm, md or lg. The theme density shifts the height of each size. | |
disabled | boolean | — | Disables the control. Inside NuiField it defaults to the field value. | |
readonly | boolean | — | Prevents changes to the value, which stays selectable and copyable. Inside NuiField it defaults to the field value. | |
required | boolean | — | Marks the control as required. Inside NuiField it defaults to the field value. | |
invalid | boolean | — | Shows the error state without a text. With error it turns on by itself. | |
label | string | — | Label of the control. Inside NuiField the field provides the label. | |
description | string | — | Hint below the control. Screen readers announce it with the control. | |
error | string | — | Error text below the control. Puts the control into the error state. | |
reserveError | boolean | false | Reserves space for the error so the form does not shift when it appears. |
Models
Name | Type | Default | Description | |
|---|---|---|---|---|
v-model | boolean | false | Whether the checkbox is checked. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | Label next to the checkbox. |
NuiCheckboxGroup
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
options*required required | readonly NuiOption<T>[] | — | Choices as objects with value, label and disabled. | |
name | string | — | The name attribute of every checkbox in the group, for form submission. | |
orientation | NuiCheckboxGroupOrientation | "vertical" | Layout: a column ( vertical) or a row (horizontal). | |
getKey | NuiOptionKey<T> | — | Function that returns the key of an object value. Without it the JSON of the value is the key. | |
id | string | — | Id of the control. Defaults to the one from NuiField or is generated automatically. | |
size | NuiSize | "md" | Changes the size of the control: sm, md or lg. The theme density shifts the height of each size. | |
disabled | boolean | — | Disables the control. Inside NuiField it defaults to the field value. | |
readonly | boolean | — | Prevents changes to the value, which stays selectable and copyable. Inside NuiField it defaults to the field value. | |
required | boolean | — | Marks the control as required. Inside NuiField it defaults to the field value. | |
invalid | boolean | — | Shows the error state without a text. With error it turns on by itself. | |
label | string | — | Label of the control. Inside NuiField the field provides the label. | |
description | string | — | Hint below the control. Screen readers announce it with the control. | |
error | string | — | Error text below the control. Puts the control into the error state. | |
reserveError | boolean | false | Reserves space for the error so the form does not shift when it appears. |
Models
Name | Type | Default | Description | |
|---|---|---|---|---|
v-model:values | T[] | [] | Array of selected values in the order they were checked. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
option | { option: NuiOption<T>; } | Custom choice label. Receives option. |