> Markdown version of [Styling](https://vaadin.com/docs/next/components/checkbox/styling). Section index: [llms.txt](https://vaadin.com/docs/next/components/llms.txt)

# Checkbox Styling

## <a id="style-variants"></a>Style Variants

The following style variants are supported by the Checkbox:

| Variant                     | Description                                                                                                                           | Supported by |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| `reverse` (since undefined) | Places the label before the checkbox, reversing their order. The label takes up the remaining space, pushing the checkbox to the end. | Aura         |
| `small`                     | Renders a more compact checkbox                                                                                                       | Aura         |

The following style variants are supported by the Checkbox Group:

| Variant              | Description                                             | Supported by |
| -------------------- | ------------------------------------------------------- | ------------ |
| `helper-above-field` | Renders the helper above the field, and below the label | Aura, Lumo   |
| `vertical`           | Vertical layout for checkbox group items                | Lumo         |
| `horizontal`         | Horizontal layout for checkbox group items              | Aura         |

### <a id="helper-above-field-variant"></a>Helper Above Field Variant

**Lit** — `checkbox-group-styles.ts`

```typescript
<vaadin-checkbox-group
  theme="helper-above-field vertical"
  label="Label"
  helper-text="Helper text"
>
</vaadin-checkbox-group>
```

**Flow** — `CheckboxGroupStyles.java`

```java
CheckboxGroup<String> field = new CheckboxGroup<>();
field.addThemeVariants(CheckboxGroupVariant.HELPER_ABOVE);
```

**React** — `checkbox-group-styles.tsx`

```tsx
<CheckboxGroup theme="helper-above-field vertical" label="Label" helperText="Helper text">
  <Checkbox value="1" label="Item 1" />
  <Checkbox value="2" label="Item 2" />
  <Checkbox value="3" label="Item 3" />
</CheckboxGroup>
```

## <a id="style-properties"></a>Style Properties

The following style properties can be used in CSS stylesheets to customize the appearance of this component.

To apply values to these properties globally in your application UI, place them in a CSS block using the `html {…​}` selector. See [Component Style Properties](https://vaadin.com/docs/next/styling/styling-components.md#component-style-properties) for more information on style properties.

> **Note: Input Field Components Shared Styles**
>
> Style properties whose names start with `--vaadin-input-field` are shared among all input field components. To apply them only to a specific type of component, use an element selector like `vaadin-text-field {…​}`

### <a id="checkbox-properties"></a>Checkbox Properties

| Property                                         | Supported by |
| ------------------------------------------------ | ------------ |
| `--vaadin-checkbox-size`                         | Aura, Lumo   |
| `--vaadin-checkbox-background`                   | Aura, Lumo   |
| `--vaadin-checkbox-background-hover`             | Lumo         |
| `--vaadin-checkbox-border-color`                 | Aura         |
| `--vaadin-checkbox-border-radius`                | Aura, Lumo   |
| `--vaadin-checkbox-border-width`                 | Aura         |
| `--vaadin-checkbox-checkmark-char`               | Lumo         |
| `--vaadin-checkbox-checkmark-char-indeterminate` | Lumo         |
| `--vaadin-checkbox-checkmark-color`              | Lumo         |
| `--vaadin-checkbox-checkmark-size`               | Lumo         |
| `--vaadin-checkbox-disabled-background`          | Lumo         |
| `--vaadin-checkbox-disabled-checkmark-color`     | Lumo         |
| `--vaadin-checkbox-gap`                          | Aura         |
| `--vaadin-checkbox-label-color`                  | Aura, Lumo   |
| `--vaadin-checkbox-label-font-size`              | Aura, Lumo   |
| `--vaadin-checkbox-label-font-weight`            | Aura         |
| `--vaadin-checkbox-label-line-height`            | Aura         |
| `--vaadin-checkbox-label-padding`                | Lumo         |
| `--vaadin-checkbox-marker-color`                 | Aura         |
| `--vaadin-checkbox-marker-size`                  | Aura         |
| `--vaadin-checkbox-readonly-checked-background`  | Lumo         |

### <a id="label"></a>Label

| Property                                        | Supported by |
| ----------------------------------------------- | ------------ |
| `--vaadin-input-field-focused-label-color`      | Lumo         |
| `--vaadin-input-field-hovered-label-color`      | Lumo         |
| `--vaadin-input-field-label-color`              | Aura, Lumo   |
| `--vaadin-input-field-label-font-size`          | Aura, Lumo   |
| `--vaadin-input-field-label-font-weight`        | Aura, Lumo   |
| `--vaadin-input-field-label-line-height`        | Aura, Lumo   |
| `--vaadin-input-field-required-indicator-color` | Aura, Lumo   |
| `--vaadin-input-field-required-indicator`       | Aura, Lumo   |

### <a id="helper"></a>Helper

| Property                                  | Supported by |
| ----------------------------------------- | ------------ |
| `--vaadin-input-field-helper-color`       | Aura, Lumo   |
| `--vaadin-input-field-helper-font-size`   | Aura, Lumo   |
| `--vaadin-input-field-helper-font-weight` | Aura, Lumo   |
| `--vaadin-input-field-helper-line-height` | Aura, Lumo   |
| `--vaadin-input-field-helper-spacing`     | Lumo         |

### <a id="error-message"></a>Error Message

| Property                                 | Supported by |
| ---------------------------------------- | ------------ |
| `--vaadin-input-field-error-color`       | Aura, Lumo   |
| `--vaadin-input-field-error-font-size`   | Aura, Lumo   |
| `--vaadin-input-field-error-font-weight` | Aura, Lumo   |
| `--vaadin-input-field-error-line-height` | Aura, Lumo   |

## <a id="css-selectors"></a>CSS Selectors

The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the [Styling documentation](https://vaadin.com/docs/next/styling.md) for more details on how to style components.

> **Important: Not for Shadow DOM**
>
> These selectors should be used in `styles.css` or another stylesheet loaded with the `@StyleSheet` annotation or the `@import` CSS rule. **They do not work in the shadow DOM of Vaadin components**, such as in stylesheets in the `components` sub-folder or loaded with the `@CssImport` annotation’s `themeFor` property.

---

### <a id="checkbox"></a>Checkbox

- Root element

  `vaadin-checkbox`

- Focused

  `vaadin-checkbox[focused]`

- Keyboard focused

  `vaadin-checkbox[focus-ring]`

- Disabled

  `vaadin-checkbox[disabled]`

- Read-only

  `vaadin-checkbox[readonly]`

- Checkbox with tooltip

  `vaadin-checkbox[has-tooltip]`

- Hovered

  `vaadin-checkbox:hover`

- Pressed

  `vaadin-checkbox[active]`

- Checked

  `vaadin-checkbox[checked]`

- Indeterminate

  `vaadin-checkbox[indeterminate]`

- Checkbox box

  `vaadin-checkbox::part(checkbox)`

- Checkmark

  `vaadin-checkbox::part(checkbox)::after`

- Label

  `vaadin-checkbox > label`

### <a id="checkbox-group"></a>Checkbox Group

- Root element

  `vaadin-checkbox-group`

#### <a id="states"></a>States

- Focused

  `vaadin-checkbox-group[focused]`

- Keyboard focused

  `vaadin-checkbox-group[focus-ring]`

- Disabled

  `vaadin-checkbox-group[disabled]`

- Read-only

  `vaadin-checkbox-group[readonly]`

- Hovered

  `vaadin-checkbox-group:hover`

- One or more checkboxes checked

  `vaadin-checkbox-group[has-value]`

- Checkbox group with tooltip

  `vaadin-checkbox-group[has-tooltip]`

#### <a id="parts"></a>Parts

- Checkbox wrapper

  `vaadin-checkbox-group::part(group-field)`

- Checkboxes

  `vaadin-checkbox-group > vaadin-checkbox`

#### <a id="label-2"></a>Label

- Checkbox group with label

  `vaadin-checkbox-group[has-label]`

- Label

  `vaadin-checkbox-group::part(label)`

- Label text

  `vaadin-checkbox-group > label`

- Required indicator

  `vaadin-checkbox-group::part(required-indicator)`

#### <a id="helper-and-validation-error"></a>Helper and Validation Error

- Field with helper

  `vaadin-checkbox-group[has-helper]`

- Helper

  `vaadin-checkbox-group::part(helper-text)`

- Helper text

  `vaadin-checkbox-group > [slot="helper"]`

- Invalid field

  `vaadin-checkbox-group[invalid]`

- Field with error message

  `vaadin-checkbox-group[has-error-message]`

- Error message

  `vaadin-checkbox-group::part(error-message)`

- Error message text

  `vaadin-checkbox-group > [slot="error-message"]`
