---
id: checkbox
scope: theming
---

The `Checkbox` component is a multipart component. The styling needs to be
applied to each part specifically.

> To learn more about styling multipart components, visit the
> [Component Style](/docs/styled-system/component-style#styling-multipart-components)
> page.

## Anatomy

- A: `control`
- B: `icon`
- C: `container`
- D: `label`

<AspectRatio ratio={16 / 9}>
  <svg
    width='100%'
    height='100%'
    viewBox='0 0 384 216'
    fill='none'
    xmlns='http://www.w3.org/2000/svg'
  >
    <rect width='384' height='216' fill='white' />
    <path
      d='M116 99C116 97.8954 116.895 97 118 97H134C135.105 97 136 97.8954 136 99V115C136 116.105 135.105 117 134 117H118C116.895 117 116 116.105 116 115V99Z'
      fill='#3182CE'
    />
    <path
      d='M124.666 109.115L130.794 102.986L131.738 103.929L124.666 111L120.424 106.757L121.366 105.815L124.666 109.115Z'
      fill='white'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M125 94L125 77L126 77L126 94L125 94Z'
      fill='#00B5D8'
    />
    <path
      d='M140 64C140 71.732 133.732 78 126 78C118.268 78 112 71.732 112 64C112 56.268 118.268 50 126 50C133.732 50 140 56.268 140 64Z'
      fill='#C4F1F9'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M126 77C133.18 77 139 71.1797 139 64C139 56.8203 133.18 51 126 51C118.82 51 113 56.8203 113 64C113 71.1797 118.82 77 126 77ZM126 78C133.732 78 140 71.732 140 64C140 56.268 133.732 50 126 50C118.268 50 112 56.268 112 64C112 71.732 118.268 78 126 78Z'
      fill='#00B5D8'
    />
    <path
      d='M122.66 70H120.796L124.984 58.3636H127.012L131.2 70H129.336L126.046 60.4773H125.955L122.66 70ZM122.973 65.4432H129.018V66.9205H122.973V65.4432Z'
      fill='#00B5D8'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M232 86L232 76L233 76L233 86L232 86Z'
      fill='#D53F8C'
    />
    <path
      d='M247 63C247 70.732 240.732 77 233 77C225.268 77 219 70.732 219 63C219 55.268 225.268 49 233 49C240.732 49 247 55.268 247 63Z'
      fill='#FED7E2'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M233 76C240.18 76 246 70.1797 246 63C246 55.8203 240.18 50 233 50C225.82 50 220 55.8203 220 63C220 70.1797 225.82 76 233 76ZM233 77C240.732 77 247 70.732 247 63C247 55.268 240.732 49 233 49C225.268 49 219 55.268 219 63C219 70.732 225.268 77 233 77Z'
      fill='#D53F8C'
    />
    <path
      d='M238.06 61.1477H236.288C236.219 60.7689 236.092 60.4356 235.907 60.1477C235.721 59.8598 235.494 59.6155 235.225 59.4148C234.956 59.214 234.655 59.0625 234.322 58.9602C233.992 58.8579 233.642 58.8068 233.271 58.8068C232.6 58.8068 232 58.9754 231.469 59.3125C230.943 59.6496 230.526 60.1439 230.219 60.7954C229.916 61.447 229.765 62.2424 229.765 63.1818C229.765 64.1288 229.916 64.928 230.219 65.5795C230.526 66.231 230.945 66.7235 231.475 67.0568C232.005 67.3901 232.602 67.5568 233.265 67.5568C233.632 67.5568 233.981 67.5076 234.31 67.4091C234.644 67.3068 234.945 67.1572 235.214 66.9602C235.483 66.7632 235.71 66.5227 235.896 66.2386C236.085 65.9507 236.216 65.6212 236.288 65.25L238.06 65.2557C237.966 65.8276 237.782 66.3542 237.509 66.8352C237.24 67.3125 236.894 67.7254 236.469 68.0738C236.049 68.4185 235.568 68.6856 235.026 68.875C234.485 69.0644 233.894 69.1591 233.253 69.1591C232.246 69.1591 231.348 68.9204 230.56 68.4432C229.772 67.9621 229.151 67.2746 228.697 66.3807C228.246 65.4867 228.021 64.4204 228.021 63.1818C228.021 61.9394 228.248 60.8731 228.702 59.9829C229.157 59.089 229.778 58.4034 230.566 57.9261C231.354 57.4451 232.25 57.2045 233.253 57.2045C233.871 57.2045 234.447 57.2935 234.981 57.4716C235.519 57.6458 236.002 57.9034 236.43 58.2443C236.858 58.5814 237.212 58.9943 237.492 59.4829C237.772 59.9678 237.962 60.5227 238.06 61.1477Z'
      fill='#D53F8C'
    />
    <path
      d='M140 153C140 160.732 133.732 167 126 167C118.268 167 112 160.732 112 153C112 145.268 118.268 139 126 139C133.732 139 140 145.268 140 153Z'
      fill='#FEFCBF'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M126 166C133.18 166 139 160.18 139 153C139 145.82 133.18 140 126 140C118.82 140 113 145.82 113 153C113 160.18 118.82 166 126 166ZM126 167C133.732 167 140 160.732 140 153C140 145.268 133.732 139 126 139C118.268 139 112 145.268 112 153C112 160.732 118.268 167 126 167Z'
      fill='#D69E2E'
    />
    <path
      d='M122.544 159V147.364H126.805C127.631 147.364 128.315 147.5 128.856 147.773C129.398 148.042 129.803 148.407 130.072 148.869C130.341 149.328 130.476 149.845 130.476 150.42C130.476 150.905 130.387 151.314 130.209 151.648C130.031 151.977 129.792 152.242 129.493 152.443C129.197 152.64 128.872 152.784 128.516 152.875V152.989C128.902 153.008 129.279 153.133 129.646 153.364C130.017 153.591 130.324 153.915 130.567 154.335C130.809 154.756 130.93 155.267 130.93 155.869C130.93 156.464 130.79 156.998 130.51 157.472C130.233 157.941 129.805 158.314 129.226 158.591C128.646 158.864 127.906 159 127.004 159H122.544ZM124.3 157.494H126.834C127.675 157.494 128.277 157.331 128.641 157.006C129.004 156.68 129.186 156.273 129.186 155.784C129.186 155.417 129.093 155.08 128.908 154.773C128.722 154.466 128.457 154.222 128.112 154.04C127.771 153.858 127.366 153.767 126.896 153.767H124.3V157.494ZM124.3 152.398H126.652C127.046 152.398 127.4 152.322 127.714 152.17C128.033 152.019 128.284 151.807 128.47 151.534C128.659 151.258 128.754 150.932 128.754 150.557C128.754 150.076 128.586 149.672 128.248 149.347C127.911 149.021 127.394 148.858 126.697 148.858H124.3V152.398Z'
      fill='#D69E2E'
    />
    <path
      d='M202 153C202 160.732 195.732 167 188 167C180.268 167 174 160.732 174 153C174 145.268 180.268 139 188 139C195.732 139 202 145.268 202 153Z'
      fill='#C6F6D5'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M188 166C195.18 166 201 160.18 201 153C201 145.82 195.18 140 188 140C180.82 140 175 145.82 175 153C175 160.18 180.82 166 188 166ZM188 167C195.732 167 202 160.732 202 153C202 145.268 195.732 139 188 139C180.268 139 174 145.268 174 153C174 160.732 180.268 167 188 167Z'
      fill='#38A169'
    />
    <path
      d='M187.272 159H183.505V147.364H187.391C188.531 147.364 189.511 147.597 190.329 148.063C191.147 148.525 191.774 149.189 192.209 150.057C192.649 150.92 192.869 151.956 192.869 153.165C192.869 154.377 192.647 155.419 192.204 156.29C191.764 157.161 191.128 157.831 190.295 158.301C189.461 158.767 188.454 159 187.272 159ZM185.261 157.466H187.175C188.062 157.466 188.798 157.299 189.386 156.966C189.973 156.629 190.412 156.142 190.704 155.506C190.995 154.866 191.141 154.085 191.141 153.165C191.141 152.252 190.995 151.477 190.704 150.841C190.416 150.205 189.986 149.722 189.414 149.392C188.842 149.063 188.132 148.898 187.283 148.898H185.261V157.466Z'
      fill='#38A169'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M277 87H106V127H277V87ZM105 86V128H278V86H105Z'
      fill='#D53F8C'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M126 139L126 115L127 115L127 139L126 139Z'
      fill='#D69E2E'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M188 139L188 120L189 120L189 139L188 139Z'
      fill='#38A169'
    />
    <path
      d='M154.773 105H153.364C153.28 104.595 153.135 104.239 152.926 103.932C152.722 103.625 152.472 103.367 152.176 103.159C151.885 102.947 151.561 102.788 151.205 102.682C150.849 102.576 150.477 102.523 150.091 102.523C149.386 102.523 148.748 102.701 148.176 103.057C147.608 103.413 147.155 103.937 146.818 104.631C146.485 105.324 146.318 106.174 146.318 107.182C146.318 108.189 146.485 109.04 146.818 109.733C147.155 110.426 147.608 110.951 148.176 111.307C148.748 111.663 149.386 111.841 150.091 111.841C150.477 111.841 150.849 111.788 151.205 111.682C151.561 111.576 151.885 111.419 152.176 111.21C152.472 110.998 152.722 110.739 152.926 110.432C153.135 110.121 153.28 109.765 153.364 109.364H154.773C154.667 109.958 154.474 110.491 154.193 110.96C153.913 111.43 153.564 111.83 153.148 112.159C152.731 112.485 152.263 112.733 151.744 112.903C151.229 113.074 150.678 113.159 150.091 113.159C149.099 113.159 148.216 112.917 147.443 112.432C146.67 111.947 146.063 111.258 145.619 110.364C145.176 109.47 144.955 108.409 144.955 107.182C144.955 105.955 145.176 104.894 145.619 104C146.063 103.106 146.67 102.417 147.443 101.932C148.216 101.447 149.099 101.205 150.091 101.205C150.678 101.205 151.229 101.29 151.744 101.46C152.263 101.631 152.731 101.881 153.148 102.21C153.564 102.536 153.913 102.934 154.193 103.403C154.474 103.869 154.667 104.401 154.773 105Z'
      fill='black'
    />
    <path
      d='M158.209 107.75V113H156.868V101.364H158.209V105.636H158.322C158.527 105.186 158.834 104.828 159.243 104.562C159.656 104.294 160.205 104.159 160.891 104.159C161.485 104.159 162.006 104.278 162.453 104.517C162.9 104.752 163.247 105.114 163.493 105.602C163.743 106.087 163.868 106.705 163.868 107.455V113H162.527V107.545C162.527 106.852 162.347 106.316 161.987 105.937C161.631 105.555 161.137 105.364 160.504 105.364C160.065 105.364 159.671 105.456 159.322 105.642C158.978 105.828 158.705 106.098 158.504 106.455C158.307 106.811 158.209 107.242 158.209 107.75Z'
      fill='black'
    />
    <path
      d='M169.98 113.182C169.139 113.182 168.414 112.996 167.804 112.625C167.198 112.25 166.73 111.727 166.401 111.057C166.075 110.383 165.912 109.598 165.912 108.705C165.912 107.811 166.075 107.023 166.401 106.341C166.73 105.655 167.188 105.121 167.776 104.739C168.367 104.352 169.056 104.159 169.844 104.159C170.298 104.159 170.747 104.235 171.19 104.386C171.634 104.538 172.037 104.784 172.401 105.125C172.764 105.462 173.054 105.909 173.27 106.466C173.486 107.023 173.594 107.708 173.594 108.523V109.091H166.867V107.932H172.23C172.23 107.439 172.132 107 171.935 106.614C171.742 106.227 171.465 105.922 171.105 105.699C170.749 105.475 170.329 105.364 169.844 105.364C169.31 105.364 168.848 105.496 168.457 105.761C168.071 106.023 167.774 106.364 167.565 106.784C167.357 107.205 167.253 107.655 167.253 108.136V108.909C167.253 109.568 167.367 110.127 167.594 110.585C167.825 111.04 168.145 111.386 168.554 111.625C168.963 111.86 169.438 111.977 169.98 111.977C170.332 111.977 170.651 111.928 170.935 111.83C171.223 111.727 171.471 111.576 171.679 111.375C171.887 111.17 172.048 110.917 172.162 110.614L173.457 110.977C173.321 111.417 173.092 111.803 172.77 112.136C172.448 112.466 172.05 112.723 171.577 112.909C171.103 113.091 170.571 113.182 169.98 113.182Z'
      fill='black'
    />
    <path
      d='M179.179 113.182C178.361 113.182 177.656 112.989 177.065 112.602C176.474 112.216 176.02 111.684 175.702 111.006C175.384 110.328 175.224 109.553 175.224 108.682C175.224 107.795 175.387 107.013 175.713 106.335C176.043 105.653 176.501 105.121 177.088 104.739C177.679 104.352 178.368 104.159 179.156 104.159C179.77 104.159 180.323 104.273 180.815 104.5C181.308 104.727 181.711 105.045 182.026 105.455C182.34 105.864 182.535 106.341 182.611 106.886H181.27C181.168 106.489 180.94 106.136 180.588 105.83C180.24 105.519 179.77 105.364 179.179 105.364C178.656 105.364 178.198 105.5 177.804 105.773C177.414 106.042 177.109 106.422 176.889 106.915C176.673 107.403 176.565 107.977 176.565 108.636C176.565 109.311 176.671 109.898 176.884 110.398C177.099 110.898 177.403 111.286 177.793 111.562C178.187 111.839 178.649 111.977 179.179 111.977C179.528 111.977 179.844 111.917 180.128 111.795C180.412 111.674 180.653 111.5 180.849 111.273C181.046 111.045 181.187 110.773 181.27 110.455H182.611C182.535 110.97 182.348 111.434 182.048 111.847C181.753 112.256 181.361 112.581 180.872 112.824C180.387 113.062 179.823 113.182 179.179 113.182Z'
      fill='black'
    />
    <path
      d='M185.821 109.818L185.798 108.159H186.071L189.889 104.273H191.548L187.48 108.386H187.367L185.821 109.818ZM184.571 113V101.364H185.912V113H184.571ZM190.117 113L186.707 108.682L187.662 107.75L191.821 113H190.117Z'
      fill='black'
    />
    <path
      d='M193.456 113V101.364H194.797V105.659H194.911C195.009 105.508 195.145 105.314 195.32 105.08C195.498 104.841 195.751 104.629 196.081 104.443C196.414 104.254 196.865 104.159 197.433 104.159C198.168 104.159 198.816 104.343 199.376 104.71C199.937 105.078 200.375 105.598 200.689 106.273C201.003 106.947 201.161 107.742 201.161 108.659C201.161 109.583 201.003 110.384 200.689 111.062C200.375 111.737 199.939 112.259 199.382 112.631C198.825 112.998 198.183 113.182 197.456 113.182C196.895 113.182 196.447 113.089 196.109 112.903C195.772 112.714 195.513 112.5 195.331 112.261C195.149 112.019 195.009 111.818 194.911 111.659H194.751V113H193.456ZM194.774 108.636C194.774 109.295 194.871 109.877 195.064 110.381C195.257 110.881 195.539 111.273 195.911 111.557C196.282 111.837 196.736 111.977 197.274 111.977C197.835 111.977 198.303 111.83 198.678 111.534C199.056 111.235 199.34 110.833 199.53 110.33C199.723 109.822 199.82 109.258 199.82 108.636C199.82 108.023 199.725 107.47 199.536 106.977C199.35 106.481 199.068 106.089 198.689 105.801C198.314 105.509 197.842 105.364 197.274 105.364C196.729 105.364 196.27 105.502 195.899 105.778C195.528 106.051 195.248 106.434 195.058 106.926C194.869 107.415 194.774 107.985 194.774 108.636Z'
      fill='black'
    />
    <path
      d='M206.757 113.182C205.969 113.182 205.278 112.994 204.683 112.619C204.092 112.244 203.63 111.72 203.297 111.045C202.967 110.371 202.803 109.583 202.803 108.682C202.803 107.773 202.967 106.979 203.297 106.301C203.63 105.623 204.092 105.097 204.683 104.722C205.278 104.347 205.969 104.159 206.757 104.159C207.545 104.159 208.234 104.347 208.825 104.722C209.42 105.097 209.882 105.623 210.212 106.301C210.545 106.979 210.712 107.773 210.712 108.682C210.712 109.583 210.545 110.371 210.212 111.045C209.882 111.72 209.42 112.244 208.825 112.619C208.234 112.994 207.545 113.182 206.757 113.182ZM206.757 111.977C207.356 111.977 207.848 111.824 208.234 111.517C208.621 111.21 208.907 110.807 209.092 110.307C209.278 109.807 209.371 109.265 209.371 108.682C209.371 108.098 209.278 107.555 209.092 107.051C208.907 106.547 208.621 106.14 208.234 105.83C207.848 105.519 207.356 105.364 206.757 105.364C206.159 105.364 205.666 105.519 205.28 105.83C204.894 106.14 204.608 106.547 204.422 107.051C204.236 107.555 204.144 108.098 204.144 108.682C204.144 109.265 204.236 109.807 204.422 110.307C204.608 110.807 204.894 111.21 205.28 111.517C205.666 111.824 206.159 111.977 206.757 111.977Z'
      fill='black'
    />
    <path
      d='M213.399 104.273L215.49 107.841L217.581 104.273H219.126L216.308 108.636L219.126 113H217.581L215.49 109.614L213.399 113H211.854L214.626 108.636L211.854 104.273H213.399Z'
      fill='black'
    />
    <path
      fillRule='evenodd'
      clipRule='evenodd'
      d='M139 94H113V120H139V94ZM112 93V121H140V93H112Z'
      fill='#00B5D8'
    />
    <circle cx='126.5' cy='114' r='2' fill='#D69E2E' />
    <circle cx='188.5' cy='119' r='2' fill='#38A169' />
  </svg>
</AspectRatio>

## Theming properties

The properties that affect the theming of the `Checkbox` component are:

- `size`: The size of the checkbox. Defaults to `md`.
- `colorScheme`: The color scheme of the checkbox. Defaults to `blue`.

## Theming utilities

- `createMultiStyleConfigHelpers`: a function that returns a set of utilities
  for creating style configs for a multipart component (`definePartsStyle` and
  `defineMultiStyleConfig`).
- `definePartsStyle`: a function used to create multipart style objects.
- `defineMultiStyleConfig`: a function used to define the style configuration
  for a multipart component.

```jsx live=false
import { checkboxAnatomy } from '@chakra-ui/anatomy'
import { createMultiStyleConfigHelpers } from '@chakra-ui/react'

const { definePartsStyle, defineMultiStyleConfig } =
  createMultiStyleConfigHelpers(checkboxAnatomy.keys)
```

## Customizing the default theme

```jsx live=false
import { checkboxAnatomy } from '@chakra-ui/anatomy'
import { createMultiStyleConfigHelpers } from '@chakra-ui/react'

const { definePartsStyle, defineMultiStyleConfig } =
  createMultiStyleConfigHelpers(checkboxAnatomy.keys)

const baseStyle = definePartsStyle({
  // define the part you're going to style
  label: {
    fontFamily: 'mono', // change the font family of the label
  },
  control: {
    padding: 3, // change the padding of the control
    borderRadius: 0, // change the border radius of the control
  },
})

export const checkboxTheme = defineMultiStyleConfig({ baseStyle })
```

After customizing the checkbox theme, we can import it in our theme file and add
it in the `components` property:

```jsx live=false
import { extendTheme } from '@chakra-ui/react'
import { checkboxTheme } from './components/checkbox.ts'

export const theme = extendTheme({
  components: { Checkbox: checkboxTheme },
})
```

> This is a crucial step to make sure that any changes that we make to the
> checkbox theme are applied.

## Adding a custom size

Let's assume we want to include an extra large checkbox size. Here's how we can
do that:

```jsx live=false
import { checkboxAnatomy } from '@chakra-ui/anatomy'
import { createMultiStyleConfigHelpers, defineStyle } from '@chakra-ui/react'

const { definePartsStyle, defineMultiStyleConfig } =
  createMultiStyleConfigHelpers(checkboxAnatomy.keys)

const sizes = {
  xl: definePartsStyle({
    control: defineStyle({
      boxSize: 14
    }),
    label: defineStyle({
      fontSize: "2xl",
      marginLeft: 6
    })
  }),
}

export const checkboxTheme = defineMultiStyleConfig({ sizes })

// Now we can use the new `xl` size
<Checkbox size="xl">...</Checkbox>
```

Every time you're adding anything new to the theme, you'd need to run the CLI
command to get proper autocomplete in your IDE. You can learn more about the CLI
tool [here](/docs/styled-system/cli).

## Adding a custom variant

Let's assume we want to include a custom circular variant. Here's how we can do
that:

```jsx live=false
import { checkboxAnatomy } from '@chakra-ui/anatomy'
import { createMultiStyleConfigHelpers, defineStyle } from '@chakra-ui/react'

const { definePartsStyle, defineMultiStyleConfig } =
  createMultiStyleConfigHelpers(checkboxAnatomy.keys)

const circular = definePartsStyle({
  control: defineStyle({
    rounded: "full"
  })
})

export const checkboxTheme = defineMultiStyleConfig({
  variants: { circular },
})

// Now we can use the new `circular` variant
<Checkbox variant="circular">...</Checkbox>
```

## Changing the default properties

Let's assume we want to change the default size and variant of every checkbox in
our app. Here's how we can do that:

```jsx live=false
import { checkboxAnatomy } from '@chakra-ui/anatomy'
import { createMultiStyleConfigHelpers, defineStyle } from '@chakra-ui/react'

const { defineMultiStyleConfig } = createMultiStyleConfigHelpers(
  checkboxAnatomy.keys,
)

export const checkboxTheme = defineMultiStyleConfig({
  defaultProps: {
    size: 'xl',
    variant: 'circular',
  },
})

// This saves you time, instead of manually setting the size and variant every time you use a checkbox:
<Checkbox size="xl" variant="circular">...</Checkbox>
```

## Showcase

import {
  App,
  Index,
  CheckboxTheme,
} from 'configs/sandpack-contents/component-theming/checkbox'

<SandpackEmbed
  files={{
    '/theme/components/Checkbox.ts': CheckboxTheme,
    '/App.tsx': App,
    '/index.tsx': {
      code: Index,
      hidden: true,
    },
  }}
  dependencies={{
    'react-icons': '^4.4.0',
  }}
  previewOptions={{
    minHeight: '500px',
  }}
/>
