File size: 8,383 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
---
title: Interactivity
description: JSX style props to enhance interactivity on an element
---
## Accent Color
Use the `accentColor` prop to set the accent color for browser generated
user-interface controls.
```jsx
// hardcoded
<label>
<chakra.input type="checkbox" accentColor="#3b82f6" />
</label>
// token value
<label>
<chakra.input type="checkbox" accentColor="blue.500" />
</label>
```
| Prop | CSS Property | Token Category |
| ------------- | -------------- | -------------- |
| `accentColor` | `accent-color` | `colors` |
## Appearance
Use the `appearance` prop to set the appearance of an element.
```jsx
<chakra.select appearance="none">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</chakra.select>
```
| Prop | CSS Property | Token Category |
| ------------ | ------------ | -------------- |
| `appearance` | `appearance` | - |
## Caret Color
Use the `caretColor` prop to set the color of the text cursor (caret) in an
input or textarea
```jsx
// hardcoded
<chakra.input caretColor="#3b82f6" />
// token value
<chakra.input caretColor="blue.500" />
```
| Prop | CSS Property | Token Category |
| ------------ | ------------- | -------------- |
| `caretColor` | `caret-color` | `colors` |
## Cursor
Use the `cursor` prop to set the mouse cursor image to show when the mouse
pointer is over an element.
```jsx
<Box cursor="pointer" />
```
| Prop | CSS Property | Token Category |
| -------- | ------------ | -------------- |
| `cursor` | `cursor` | - |
## Pointer Events
Use the `pointerEvents` prop to control how pointer events are handled on an
element.
```jsx
<Box pointerEvents="none">Can't click me</Box>
```
| Prop | CSS Property | Token Category |
| --------------- | ---------------- | -------------- |
| `pointerEvents` | `pointer-events` | - |
## Resize
Use the `resize` prop to control whether an element is resizable, and if so, in
which directions.
```jsx
<chakra.textarea resize="both" />
<chakra.textarea resize="horizontal" />
<chakra.textarea resize="vertical" />
```
| Prop | CSS Property | Token Category |
| -------- | ------------ | -------------- |
| `resize` | `resize` | - |
## Scrollbar
Use the `scrollbar` prop to customize the appearance of scrollbars.
```jsx
<Box scrollbar="hidden" maxH="100px" overflowY="auto">
Scrollbar hidden
</Box>
```
## Scroll Behavior
Use the `scrollBehavior` prop to set the behavior for a scrolling box when
scrolling is triggered by the navigation or JavaScript code.
```jsx
<Box maxH="100px" overflowY="auto" scrollBehavior="smooth">
<div>Scroll me</div>
</Box>
```
| Prop | CSS Property | Token Category |
| ---------------- | ----------------- | -------------- |
| `scrollBehavior` | `scroll-behavior` | - |
## Scroll Margin
Use the `scrollMargin*` prop to set margins around scroll containers.
```jsx
<Box maxH="100px" overflowY="auto" scrollMarginY="2">
Scrollbar Container with block padding
</Box>
```
| Prop | CSS Property | Token Category |
| ------------------------------------- | ---------------------------- | -------------- |
| `scrollMarginX` ,`scrollMarginInline` | `scroll-margin-inline` | `spacing` |
| `scrollMarginInlineStart` | `scroll-margin-inline-start` | `spacing` |
| `scrollMarginInlineEnd` | `scroll-margin-inline-end` | `spacing` |
| `scrollMarginY` , `scrollMarginBlock` | `scroll-margin-block` | `spacing` |
| `scrollMarginBlockStart` | `scroll-margin-block-start` | `spacing` |
| `scrollMarginBlockEnd` | `scroll-margin-block-end` | `spacing` |
| `scrollMarginLeft` | `scroll-margin-left` | `spacing` |
| `scrollMarginRight` | `scroll-margin-right` | `spacing` |
| `scrollMarginTop` | `scroll-margin-top` | `spacing` |
| `scrollMarginBottom` | `scroll-margin-bottom` | `spacing` |
## Scroll Padding
Use the `scrollPadding*` prop to set padding inside scroll containers.
```jsx
<Box maxH="100px" overflowY="auto" scrollPaddingY="2">
Scrollbar Container with block padding
</Box>
```
| Prop | CSS Property | Token Category |
| ---------------------------------------- | ----------------------------- | -------------- |
| `scrollPaddingX` , `scrollPaddingInline` | `scroll-padding-inline` | `spacing` |
| `scrollPaddingInlineStart` | `scroll-padding-inline-start` | `spacing` |
| `scrollPaddingInlineEnd` | `scroll-padding-inline-end` | `spacing` |
| `scrollPaddingY` , `scrollPaddingBlock` | `scroll-padding-block` | `spacing` |
| `scrollPaddingBlockStart` | `scroll-padding-block-start` | `spacing` |
| `scrollPaddingBlockEnd` | `scroll-padding-block-end` | `spacing` |
| `scrollPaddingLeft` | `scroll-padding-left` | `spacing` |
| `scrollPaddingRight` | `scroll-padding-right` | `spacing` |
| `scrollPaddingTop` | `scroll-padding-top` | `spacing` |
| `scrollPaddingBottom` | `scroll-padding-bottom` | `spacing` |
## Scroll Snap Margin
Use the `scrollSnapMargin*` prop to set margins around scroll containers.
```jsx
<Box maxH="100px" overflowY="auto" scrollSnapMarginY="2">
Scrollbar Container with block padding
</Box>
```
| Prop | CSS Property | Token Category |
| ------------------------ | ---------------------- | -------------- |
| `scrollSnapMargin` | `scroll-margin` | `spacing` |
| `scrollSnapMarginTop` | `scroll-margin-top` | `spacing` |
| `scrollSnapMarginBottom` | `scroll-margin-bottom` | `spacing` |
| `scrollSnapMarginLeft` | `scroll-margin-left` | `spacing` |
| `scrollSnapMarginRight` | `scroll-margin-right` | `spacing` |
## Scroll Snap Type
Use the `scrollSnapType` prop to control how strictly snap points are enforced
in a scroll container.
```jsx
<Box maxH="100px" overflowY="auto" scrollSnapType="x">
Scroll container with x snap type
</Box>
```
| Value | |
| ------ | ------------------------------------ |
| `none` | `none` |
| `x` | `x var(--scroll-snap-strictness)` |
| `y` | `y var(--scroll-snap-strictness)` |
| `both` | `both var(--scroll-snap-strictness)` |
## Scroll Snap Strictness
Use the `scrollSnapStrictness` prop to set the scroll snap strictness of an
element. This requires `scrollSnapType` to be set to `x`,`y` or `both`.
It's values can be `mandatory` or `proximity` values, and maps to
`var(--scroll-snap-strictness)`.
```jsx
<Box maxH="100px" overflowY="auto" scrollSnapStrictness="proximity">
<Box>Item 1</Box>
<Box>Item 2</Box>
</Box>
```
| Prop | CSS Property | Token Category |
| ---------------------- | -------------------------- | -------------- |
| `scrollSnapStrictness` | `--scroll-snap-strictness` | - |
## Touch Action
Use the `touchAction` prop to control how an element's region can be manipulated
by a touchscreen user
```jsx
<Box touchAction="none" />
```
| Prop | CSS Property | Token Category |
| ------------- | -------------- | -------------- |
| `touchAction` | `touch-action` | - |
## User Select
Use the `userSelect` prop to control whether the user can select text within an
element.
```jsx
<Box userSelect="none">
<p>Can't Select me</p>
</Box>
```
| Prop | CSS Property | Token Category |
| ------------ | ------------- | -------------- |
| `userSelect` | `user-select` | - |
## Will Change
Use the `willChange` prop to hint browsers how an element's property is expected
to change.
```jsx
<Box willChange="transform" />
```
| Prop | CSS Property | Token Category |
| ------------ | ------------- | -------------- |
| `willChange` | `will-change` | - |
|