Aside
configuration, controls width, breakpoints and collapsed state. Required if you use Aside
component. |
| disabled | boolean | - | If set, Navbar
, Aside
, Header
and Footer
components are hidden |
| footer | AppShellFooterConfiguration | - | Footer
configuration, controls height, offset and collapsed state. Required if you use Footer
component. |
| header | AppShellHeaderConfiguration | - | Header
configuration, controls height, offset and collapsed state. Required if you use Header
component. |
| layout | "default" | "alt" | - | Determines how Navbar
/Aside
are arranged relative to Header
/Footer
|
| navbar | AppShellNavbarConfiguration | - | Navbar
configuration, controls width, breakpoints and collapsed state. Required if you use Navbar
component. |
| offsetScrollbars | boolean | - | If set, Header
and Footer
components include styles to offset scrollbars. Based on react-remove-scroll
. |
| padding | MantineSpacing | AppShellResponsiveSize | - | Padding of the main section. Important: use padding
prop instead of p
. |
| transitionDuration | number | - | Duration of all transitions in ms |
| transitionTimingFunction | TransitionTimingFunction | - | Timing function of all transitions |
| withBorder | boolean | - | If set, the associated components have a border |
| zIndex | string | number | - | z-index
of all associated elements |
#### Styles API
AppShell component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**AppShell selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-AppShell-root | Root element (`AppShell` component) |
| navbar | .mantine-AppShell-navbar | `AppShell.Navbar` root element |
| header | .mantine-AppShell-header | `AppShell.Header` root element |
| main | .mantine-AppShell-main | `AppShell.Main` root element |
| aside | .mantine-AppShell-aside | `AppShell.Aside` root element |
| footer | .mantine-AppShell-footer | `AppShell.Footer` root element |
| section | .mantine-AppShell-section | `AppShell.Section` root element |
**AppShell CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --app-shell-transition-duration | Controls transition duration of all children |
**AppShell data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-resizing | User is resizing the window | - |
| root | data-layout | - | Value of the |
| root | data-disabled | - | - |
--------------------------------------------------------------------------------
### AspectRatio
Package: @mantine/core
Import: import { AspectRatio } from '@mantine/core';
Description: Maintain responsive consistent width/height ratio
## Usage
`AspectRatio` maintains a consistent width/height ratio.
It can be used to display images, maps, videos and other media.
#### Example: image
```tsx
import { AspectRatio } from '@mantine/core';
function Demo() {
return (

16 / 9
, 4 / 3
, 1920 / 1080
|
#### Styles API
AspectRatio component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**AspectRatio selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-AspectRatio-root | Root element |
**AspectRatio CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --ar-ratio | Aspect ratio |
--------------------------------------------------------------------------------
### Autocomplete
Package: @mantine/core
Import: import { Autocomplete } from '@mantine/core';
Description: Autocomplete user input with any list of options
Combobox
component |
| data | ComboboxStringData | - | Data used to display options. Values must be unique. |
| defaultDropdownOpened | boolean | - | Uncontrolled dropdown initial opened state |
| defaultValue | string | - | Default value for uncontrolled component |
| description | React.ReactNode | - | Contents of Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| dropdownOpened | boolean | - | Controlled dropdown opened state |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| filter | OptionsFilter | - | Function based on which items are filtered and sorted |
| inputContainer | ((children: ReactNode) => ReactNode) | - | Input container component |
| inputSize | string | - | size
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| limit | number | - | Maximum number of options displayed at a time, Infinity
by default |
| maxDropdownHeight | string | number | - | max-height
of the dropdown, only applicable when withScrollArea
prop is true
, 250
by default |
| onChange | ((value: string) => void) | - | Called when value changes |
| onClear | (() => void) | - | Called when the clear button is clicked |
| onDropdownClose | (() => void) | - | Called when dropdown closes |
| onDropdownOpen | (() => void) | - | Called when dropdown opens |
| onOptionSubmit | ((value: string) => void) | - | Called when option is submitted from dropdown with mouse click or Enter
key |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| renderOption | RenderAutocompleteOption | - | Function to render custom option content |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| scrollAreaProps | ScrollAreaProps | - | Props passed to the underlying ScrollArea
component in the dropdown |
| selectFirstOptionOnChange | boolean | - | If set, the first option is selected when value changes, false
by default |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| value | string | - | Controlled component value |
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| withScrollArea | boolean | - | Determines whether the options should be wrapped with ScrollArea.AutoSize
, true
by default |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
Autocomplete component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Autocomplete selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-Autocomplete-wrapper | Root element of the Input |
| input | .mantine-Autocomplete-input | Input element |
| section | .mantine-Autocomplete-section | Left and right sections |
| root | .mantine-Autocomplete-root | Root element |
| label | .mantine-Autocomplete-label | Label element |
| required | .mantine-Autocomplete-required | Required asterisk element, rendered inside label |
| description | .mantine-Autocomplete-description | Description element |
| error | .mantine-Autocomplete-error | Error element |
--------------------------------------------------------------------------------
### Avatar
Package: @mantine/core
Import: import { Avatar } from '@mantine/core';
Description: Display user profile image, initials or fallback icon
## Usage
#### Example: usage
```tsx
import { Avatar } from '@mantine/core';
import { IconStar } from '@tabler/icons-react';
function Demo() {
return (
<>
{/* With image */}
alt
attribute, also used as title
attribute for placeholder |
| autoContrast | boolean | - | If set, adjusts text color based on background color for filled
variant |
| children | React.ReactNode | - | Avatar placeholder, displayed when src={null}
or when the image cannot be loaded |
| color | DefaultMantineColor | "initials" | - | Key of theme.colors
or any valid CSS color |
| gradient | MantineGradient | - | Gradient configuration for variant="gradient"
|
| imageProps | React.ComponentPropsWithoutRef<"img"> | - | Attributes passed down to img
element |
| name | string | - | Name of the user. When src
is not set, used to display initials and to generate color when color="initials"
is set. |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius |
| size | number | MantineSize | (string & {}) | - | Width and height of the avatar, numbers are converted to rem |
| src | string | null | - | Image url, if the image cannot be loaded or src={null}
, then placeholder is displayed instead |
#### Styles API
Avatar component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Avatar selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Avatar-root | Root element |
| image | .mantine-Avatar-image | `img` element |
| placeholder | .mantine-Avatar-placeholder | Avatar placeholder, displayed when the image cannot be loaded |
**Avatar CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --avatar-bd | Controls placeholder `border` |
| root | --avatar-bg | Controls placeholder `background` |
| root | --avatar-color | Controls placeholder text `color` |
| root | --avatar-size | Controls `width`, `min-width` and `height` |
| root | --avatar-radius | Controls `border-radius` |
**Avatar.Group selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| group | .mantine-AvatarGroup-group | Root element |
**Avatar.Group CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| group | --ag-spacing | Controls negative spacing between avatars |
--------------------------------------------------------------------------------
### BackgroundImage
Package: @mantine/core
Import: import { BackgroundImage } from '@mantine/core';
Description: Displays image as background
## Usage
#### Example: usage
```tsx
import { BackgroundImage, Center, Text, Box } from '@mantine/core';
function Demo() {
return (
theme.radius
or any valid CSS value to set border-radius, numbers are converted to rem |
| src | string | required | Image url |
#### Styles API
BackgroundImage component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**BackgroundImage selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-BackgroundImage-root | Root element |
**BackgroundImage CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --bi-radius | Controls `border-radius` |
--------------------------------------------------------------------------------
### Badge
Package: @mantine/core
Import: import { Badge } from '@mantine/core';
Description: Display badge, pill or tag
## Usage
#### Example: usage
```tsx
import { Badge } from '@mantine/core';
function Demo() {
return filled
variant |
| children | React.ReactNode | - | Main badge content |
| circle | boolean | - | If set, badge min-width
becomes equal to its height
and horizontal padding is removed |
| color | MantineColor | - | Key of theme.colors
or any valid CSS color |
| fullWidth | boolean | - | Determines whether Badge should take 100% of its parent width |
| gradient | MantineGradient | - | Gradient configuration used when variant=\"gradient\"
|
| leftSection | React.ReactNode | - | Content displayed on the left side of the badge label |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| rightSection | React.ReactNode | - | Content displayed on the right side of the badge label |
| size | MantineSize | (string & {}) | - | Controls font-size
, height
and horizontal padding
|
#### Styles API
Badge component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Badge selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Badge-root | Root element |
| section | .mantine-Badge-section | Left and right sections |
| label | .mantine-Badge-label | Badge children |
**Badge CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --badge-bd | Controls `border` |
| root | --badge-bg | Controls `background` |
| root | --badge-color | Controls text `color` |
| root | --badge-dot-color | Controls dot `color`, only applicable when `variant="dot"` |
| root | --badge-fz | Controls `font-size` |
| root | --badge-height | Controls `height` |
| root | --badge-padding-x | Controls horizontal `padding` |
| root | --badge-radius | Controls `border-radius` |
**Badge data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-block | - | - |
| section | data-position | - | Section position: left or right |
--------------------------------------------------------------------------------
### Blockquote
Package: @mantine/core
Import: import { Blockquote } from '@mantine/core';
Description: Blockquote with optional cite
## Usage
#### Example: usage
```tsx
import { Blockquote } from '@mantine/core';
import { IconInfoCircle } from '@tabler/icons-react';
function Demo() {
const icon = Life is like an npm install β you never know what you are going to get.); } ``` #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | cite | React.ReactNode | - | Reference to a cited quote | | color | MantineColor | - | Key of
theme.colors
or any valid CSS color |
| icon | React.ReactNode | - | Blockquote icon, displayed at the top left side |
| iconSize | string | number | - | Controls icon width
and height
, numbers are converted to rem |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
#### Styles API
Blockquote component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Blockquote selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Blockquote-root | Root element |
| icon | .mantine-Blockquote-icon | Icon element |
| cite | .mantine-Blockquote-cite | Cite element |
**Blockquote CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --bq-bd | Controls `border` |
| root | --bq-bg-dark | Controls `background-color` in dark color scheme |
| root | --bq-bg-light | Controls `background-color` in light color scheme |
| root | --bq-icon-size | Controls `width` and `height` of the icon |
| root | --bq-radius | Controls `border-radius` |
--------------------------------------------------------------------------------
### Box
Package: @mantine/core
Import: import { Box } from '@mantine/core';
Description: Base component for all Mantine components
## Usage
`Box` component is used as a base for all other components. `Box` supports the following features:
* [component prop](https://mantine.dev/guides/polymorphic)
* [style props](https://mantine.dev/styles/style-props)
* [style prop](https://mantine.dev/styles/style)
You can use `Box` as a base for your own components or as a replacement for HTML elements:
```tsx
import { Box } from '@mantine/core';
function Demo() {
return (
separator
|
| separator | React.ReactNode | - | Separator between children |
| separatorMargin | MantineSpacing | - | Controls spacing between separator and breadcrumb |
#### Styles API
Breadcrumbs component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Breadcrumbs selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Breadcrumbs-root | Root element |
| separator | .mantine-Breadcrumbs-separator | Separator between children |
| breadcrumb | .mantine-Breadcrumbs-breadcrumb | Breadcrumb item |
**Breadcrumbs CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --bc-separator-margin | Control left and right `margin` of separator |
--------------------------------------------------------------------------------
### Burger
Package: @mantine/core
Import: import { Burger } from '@mantine/core';
Description: Open/close navigation button
## Usage
`Burger` component renders open/close menu button.
Set `opened` and `onClick` props to control component state.
If `opened` prop is set, cross will be rendered, otherwise β burger.
#### Example: usage
```tsx
import { useDisclosure } from '@mantine/hooks';
import { Burger } from '@mantine/core';
function Demo() {
const [opened, { toggle }] = useDisclosure();
return theme.colors
of any valid CSS value, by default theme.white
in dark color scheme and theme.black
in light |
| lineSize | string | number | - | Controls height of lines, by default calculated based on size
prop |
| opened | boolean | - | State of the burger, when true
burger is transformed into X |
| size | number | MantineSize | (string & {}) | - | Controls burger width
and height
, numbers are converted to rem |
| transitionDuration | number | - | transition-duration
property value in ms |
| transitionTimingFunction | string | - | transition-timing-function
property value |
#### Styles API
Burger component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Burger selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Burger-root | Root element (button) |
| burger | .mantine-Burger-burger | Inner element that contains burger lines |
**Burger CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --burger-line-size | Controls height of lines |
| root | --burger-color | Controls background-color of lines |
| root | --burger-size | Controls width and height of the button |
| root | --burger-transition-duration | Controls transition-duration of lines |
| root | --burger-transition-timing-function | Controls transition-timing-function of lines |
**Burger data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| burger | data-opened | opened prop is set | - |
--------------------------------------------------------------------------------
### Button
Package: @mantine/core
Import: import { Button } from '@mantine/core';
Description: Button component to render button or link
## Usage
#### Example: configurator
```tsx
import { Button } from '@mantine/core';
function Demo() {
return ;
}
```
## Full width
If `fullWidth` prop is set `Button` will take 100% of parent width:
#### Example: fullWidth
```tsx
import { Button } from '@mantine/core';
function Demo() {
return ;
}
```
## Left and right sections
`leftSection` and `rightSection` allow adding icons or any other element to the left and right side of the button.
When a section is added, padding on the corresponding side is reduced.
Note that `leftSection` and `rightSection` are flipped in [RTL](https://mantine.dev/styles/rtl) mode
(`leftSection` is displayed on the right and `rightSection` is displayed on the left).
#### Example: sections
```tsx
import { Group, Button } from '@mantine/core';
import { IconPhoto, IconDownload, IconArrowRight } from '@tabler/icons-react';
function Demo() {
return (
filled
variant |
| children | React.ReactNode | - | Button content |
| color | MantineColor | - | Key of theme.colors
or any valid CSS color |
| disabled | boolean | - | Sets disabled
attribute, applies disabled styles |
| fullWidth | boolean | - | If set, the button takes 100% width of its parent container |
| gradient | MantineGradient | - | Gradient configuration used when variant="gradient"
|
| justify | JustifyContent | - | Sets justify-content
of inner
element, can be used to change distribution of sections and label |
| leftSection | React.ReactNode | - | Content displayed on the left side of the button label |
| loaderProps | LoaderProps | - | Props added to the Loader
component (only visible when loading
prop is set) |
| loading | boolean | - | If set, the Loader
component is displayed over the button |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| rightSection | React.ReactNode | - | Content displayed on the right side of the button label |
| size | MantineSize | (string & {}) | "compact-xs" | "compact-sm" | "compact-md" | "compact-lg" | "compact-xl" | - | Controls button height
, font-size
and horizontal padding
|
#### Styles API
Button component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Button selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Button-root | Root element |
| loader | .mantine-Button-loader | Loader component, displayed only when `loading` prop is set |
| inner | .mantine-Button-inner | Contains all other elements, child of the `root` element |
| section | .mantine-Button-section | Left and right sections of the button |
| label | .mantine-Button-label | Button children |
**Button CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --button-bg | Controls `background` |
| root | --button-bd | Control `border` |
| root | --button-hover | Controls `background` when hovered |
| root | --button-color | Control text `color` |
| root | --button-hover-color | Control text `color` when hovered |
| root | --button-radius | Controls `border-radius` |
| root | --button-height | Controls `height` of the button |
| root | --button-padding-x | Controls horizontal `padding` of the button |
| root | --button-fz | Controls `font-size` of the button |
| root | --button-justify | Controls `justify-content` of `inner` element |
**Button data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-disabled | - | - |
**Button.Group selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| group | .mantine-ButtonGroup-group | Root element |
**Button.Group CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| group | --button-border-width | `border-width` of child `Button` components |
**Button.Group data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| group | data-orientation | - | Value of |
--------------------------------------------------------------------------------
### Card
Package: @mantine/core
Import: import { Card } from '@mantine/core';
Description: Card with sections
## Usage
`Card` is a wrapper around [Paper](https://mantine.dev/core/paper/) component with some additional styles and `Card.Section`
component that allows to split card into sections. If you do not need sections, you use [Paper](https://mantine.dev/core/paper/) component instead.
#### Example: usage
```tsx
import { Card, Image, Text, Badge, Button, Group } from '@mantine/core';
function Demo() {
return (
theme.spacing
or any valid CSS value to set padding |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius, numbers are converted to rem |
| shadow | MantineShadow | - | Key of theme.shadows
or any valid CSS value to set box-shadow
|
| withBorder | boolean | - | Adds border to the card |
#### Styles API
Card component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Card selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Card-root | Root element |
| section | .mantine-Card-section | `Card.Section` root element |
**Card CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
**Card data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| section | data-first-section | - | - |
| section | data-last-section | - | - |
| root | data-with-border | - | - |
| section | data-with-border | - | - |
| section | data-inherit-padding | - | - |
--------------------------------------------------------------------------------
### Center
Package: @mantine/core
Import: import { Center } from '@mantine/core';
Description: Centers content vertically and horizontally
## Usage
#### Example: usage
```tsx
import { Center, Box } from '@mantine/core';
function Demo() {
return (
inline-flex
is used instead of flex
|
#### Styles API
Center component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Center selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Center-root | Root element |
--------------------------------------------------------------------------------
### Checkbox
Package: @mantine/core
Import: import { Checkbox } from '@mantine/core';
Description: Capture boolean input from user
## Usage
#### Example: configurator
```tsx
import { Checkbox } from '@mantine/core';
function Demo() {
return (
filled
variant |
| color | MantineColor | - | Key of theme.colors
or any valid CSS color to set input background color in checked state |
| description | React.ReactNode | - | Description displayed below the label |
| error | React.ReactNode | - | Error message displayed below the label |
| icon | FC<{ indeterminate: boolean; className: string; }> | undefined | - | Icon displayed when checkbox is in checked or indeterminate state |
| iconColor | MantineColor | - | Key of theme.colors
or any valid CSS color to set icon color. By default, depends on theme.autoContrast
. |
| id | string | - | Unique input id |
| indeterminate | boolean | - | Indeterminate state of the checkbox. If set, checked
prop is ignored. |
| label | React.ReactNode | - | label
associated with the checkbox |
| labelPosition | "left" | "right" | - | Position of the label relative to the input |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| rootRef | ForwardedReffilled
variant |
| checked | boolean | - | Checked state for controlled component |
| children | React.ReactNode | required | label
element associated with the input |
| color | MantineColor | - | Controls components colors based on variant
prop. Key of theme.colors
or any valid CSS color. |
| defaultChecked | boolean | - | Default checked state for uncontrolled component |
| icon | React.ReactNode | - | Any element or component to replace default icon |
| id | string | - | Unique input id |
| onChange | ((checked: boolean) => void) | - | Calls when checked state changes |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| rootRef | ForwardedRefVisuallyHidden
with label for screen readers. |
| disabled | boolean | - | Sets disabled
attribute, assigns disabled styles |
| icon | React.ReactNode | - | React node to replace the default close icon. If set, iconSize
prop is ignored. |
| iconSize | string | number | - | X
icon width
and height
|
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius. Numbers are converted to rem. |
| size | number | MantineSize | (string & {}) | - | Controls width and height of the button. Numbers are converted to rem. |
#### Styles API
CloseButton component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**CloseButton selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-CloseButton-root | Root element |
**CloseButton CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --cb-icon-size | Controls `width` of the `X` icon |
| root | --cb-radius | Controls `border-radius` of the button |
| root | --cb-size | Controls `width` and `height` of the button |
--------------------------------------------------------------------------------
### Code
Package: @mantine/core
Import: import { Code } from '@mantine/core';
Description: Inline and block code
## Usage
By default, Code component renders inline `code` html element:
#### Example: usage
```tsx
import { Code } from '@mantine/core';
function Demo() {
return React.createElement()
;
}
```
## Block code
To render code in `pre` element pass `block` prop to Code component:
#### Example: block
```tsx
import { Code } from '@mantine/core';
const codeForPreviousDemo = `import { Code } from '@mantine/core';
function Demo() {
return React.createElement()
;
}`;
function Demo() {
return {codeForPreviousDemo}
;
}
```
## Custom color
By default, code color is gray, you can change it to any valid CSS color or to one
of the [theme.colors](https://mantine.dev/theming/colors):
#### Example: colors
```tsx
import { Code, Group } from '@mantine/core';
function Demo() {
return (
React.createElement()
React.createElement()
pre
|
| color | MantineColor | - | Key of theme.colors
or any valid CSS color, controls background-color
of the code. By default, calculated based on the color scheme. |
#### Styles API
Code component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Code selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Code-root | Root element |
**Code CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --code-bg | Controls `background-color` |
**Code data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-block | - | - |
**Codehighlight selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| codeHighlight | .mantine-Codehighlight-codeHighlight | Root element |
| showCodeButton | .mantine-Codehighlight-showCodeButton | Button that reveals full code when it is collapsed |
| pre | .mantine-Codehighlight-pre | Pre element, contains code element |
| code | .mantine-Codehighlight-code | Code element |
| control | .mantine-Codehighlight-control | Control button, copy/collapse, custom controls |
| controlTooltip | .mantine-Codehighlight-controlTooltip | Root element of control tooltip |
| controls | .mantine-Codehighlight-controls | A wrapper around controls |
| scrollarea | .mantine-Codehighlight-scrollarea | Scroll area, contains code |
**Codehighlight CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| codeHighlight | --ch-background | Background color |
| codeHighlight | --ch-max-height | Max height of code block in collapsed state |
| codeHighlight | --ch-radius | Border radius |
**Codehighlighttabs selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| codeHighlight | .mantine-Codehighlighttabs-codeHighlight | Root element of inner CodeHighlight component |
| showCodeButton | .mantine-Codehighlighttabs-showCodeButton | Button that reveals full code when it is collapsed |
| pre | .mantine-Codehighlighttabs-pre | Pre element, contains code element |
| code | .mantine-Codehighlighttabs-code | Code element |
| control | .mantine-Codehighlighttabs-control | Control button, copy/collapse, custom controls |
| controlTooltip | .mantine-Codehighlighttabs-controlTooltip | Root element of control tooltip |
| controls | .mantine-Codehighlighttabs-controls | A wrapper around controls |
| scrollarea | .mantine-Codehighlighttabs-scrollarea | Scroll area, contains code |
| root | .mantine-Codehighlighttabs-root | Root element |
| filesScrollarea | .mantine-Codehighlighttabs-filesScrollarea | Scrollarea with files list |
| files | .mantine-Codehighlighttabs-files | Files names list |
| file | .mantine-Codehighlighttabs-file | File name |
| fileIcon | .mantine-Codehighlighttabs-fileIcon | File icon |
--------------------------------------------------------------------------------
### Collapse
Package: @mantine/core
Import: import { Collapse } from '@mantine/core';
Description: Animate presence with slide down/up transition
## Usage
#### Example: usage
```tsx
import { Button, Group, Text, Collapse, Box } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
function Demo() {
const [opened, { toggle }] = useDisclosure(false);
return (
Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| disallowInput | boolean | - | If input is not allowed, the user can only pick value with color picker and swatches |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| eyeDropperButtonProps | Recordsize
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| onChange | ((value: string) => void) | - | Called when value changes |
| onChangeEnd | ((value: string) => void) | - | Called when the user stops dragging one of the sliders or changes the value with keyboard |
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| popoverProps | PopoverProps | - | Props passed down to the Popover
component |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| swatches | string[] | - | A list of colors used to display swatches list below the color picker |
| swatchesPerRow | number | - | Number of swatches per row |
| value | string | - | Controlled component value |
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| withEyeDropper | boolean | - | If set, the eye dropper button is displayed in the right section |
| withPicker | boolean | - | Determines whether the color picker should be displayed |
| withPreview | boolean | - | If set, the preview color swatch is displayed in the left section of the input |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
ColorInput component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**ColorInput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-ColorInput-wrapper | Root element |
| input | .mantine-ColorInput-input | Input element |
| section | .mantine-ColorInput-section | Left and right sections |
| root | .mantine-ColorInput-root | Root element |
| label | .mantine-ColorInput-label | Label element |
| required | .mantine-ColorInput-required | Required asterisk element, rendered inside label |
| description | .mantine-ColorInput-description | Description element |
| error | .mantine-ColorInput-error | Error element |
| preview | .mantine-ColorInput-preview | Color preview, displayed only when `format` supports alpha channel |
| body | .mantine-ColorInput-body | Contains alpha/hue sliders and color preview |
| slider | .mantine-ColorInput-slider | Alpha and hue sliders root |
| sliderOverlay | .mantine-ColorInput-sliderOverlay | Element used to display various overlays over hue and alpha sliders |
| saturation | .mantine-ColorInput-saturation | Saturation picker |
| saturationOverlay | .mantine-ColorInput-saturationOverlay | Element used to display various overlays over saturation picker |
| sliders | .mantine-ColorInput-sliders | Contains alpha and hue sliders |
| thumb | .mantine-ColorInput-thumb | Thumb of all sliders |
| swatch | .mantine-ColorInput-swatch | Color swatch |
| swatches | .mantine-ColorInput-swatches | Color swatches list |
| dropdown | .mantine-ColorInput-dropdown | Popover dropdown |
| colorPreview | .mantine-ColorInput-colorPreview | Color swatch preview in input left section |
| eyeDropperButton | .mantine-ColorInput-eyeDropperButton | Eye dropper button |
| eyeDropperIcon | .mantine-ColorInput-eyeDropperIcon | Default eye dropper icon |
**ColorInput CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| colorPreview | --ci-preview-size | Controls `width` and `height` of color preview |
--------------------------------------------------------------------------------
### ColorPicker
Package: @mantine/core
Import: import { ColorPicker } from '@mantine/core';
Description: Pick colors in hex(a), rgb(a), hsl(a) and hsv(a) formats
## Usage
#### Example: usage
```tsx
import { useState } from 'react';
import { ColorPicker, Text } from '@mantine/core';
function Demo() {
const [value, onChange] = useState('rgba(47, 119, 150, 0.7)');
return (
<>
aria-label
|
| defaultValue | string | - | Uncontrolled component default value |
| focusable | boolean | - | If set, interactive elements (sliders thumbs and swatches) are focusable with keyboard |
| format | ColorFormat | - | Color format |
| fullWidth | boolean | - | If set, the component takes 100% width of its container |
| hueLabel | string | - | Hue slider aria-label
|
| onChange | ((value: string) => void) | - | Called when value changes |
| onChangeEnd | ((value: string) => void) | - | Called when the user stops dragging one of the sliders or changes the value with keyboard |
| onColorSwatchClick | ((color: string) => void) | - | Called when one of the color swatches is clicked |
| saturationLabel | string | - | Saturation slider aria-label
|
| size | MantineSize | (string & {}) | - | Controls size of hue, alpha and saturation sliders |
| swatches | string[] | - | A list of colors used to display swatches list below the color picker |
| swatchesPerRow | number | - | Number of swatches per row |
| value | string | - | Controlled component value |
| withPicker | boolean | - | Determines whether the color picker should be displayed |
#### Styles API
ColorPicker component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**ColorPicker selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-ColorPicker-wrapper | Root element |
| preview | .mantine-ColorPicker-preview | Color preview, displayed only when `format` supports alpha channel |
| body | .mantine-ColorPicker-body | Contains alpha/hue sliders and color preview |
| slider | .mantine-ColorPicker-slider | Alpha and hue sliders root |
| sliderOverlay | .mantine-ColorPicker-sliderOverlay | Element used to display various overlays over hue and alpha sliders |
| saturation | .mantine-ColorPicker-saturation | Saturation picker |
| saturationOverlay | .mantine-ColorPicker-saturationOverlay | Element used to display various overlays over saturation picker |
| sliders | .mantine-ColorPicker-sliders | Contains alpha and hue sliders |
| thumb | .mantine-ColorPicker-thumb | Thumb of all sliders |
| swatch | .mantine-ColorPicker-swatch | Color swatch |
| swatches | .mantine-ColorPicker-swatches | Color swatches list |
**ColorPicker CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| wrapper | --cp-body-spacing | Controls spacing between sliders and saturation |
| wrapper | --cp-preview-size | Controls size of the preview swatch |
| wrapper | --cp-width | Controls `width` of the root element |
| wrapper | --cp-swatch-size | Controls swatch `width` and `height` |
| wrapper | --cp-thumb-size | Controls thumb `width` and `height` in all sliders and saturation picker |
| wrapper | --cp-saturation-height | Controls `height` of the saturation picker |
--------------------------------------------------------------------------------
### ColorSwatch
Package: @mantine/core
Import: import { ColorSwatch } from '@mantine/core';
Description: Displays color
## Usage
#### Example: usage
```tsx
import { ColorSwatch, Group } from '@mantine/core';
function Demo() {
return (
theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem. |
| size | React.CSSProperties["width"] | - | Controls width
and height
of the swatch, any valid CSS value, numbers are converted to rem. |
| withShadow | boolean | - | Determines whether the swatch should have inner box-shadow
|
#### Styles API
ColorSwatch component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**ColorSwatch selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-ColorSwatch-root | Root element |
| alphaOverlay | .mantine-ColorSwatch-alphaOverlay | Overlay with checkerboard pattern |
| shadowOverlay | .mantine-ColorSwatch-shadowOverlay | Overlay with inner box-shadow |
| colorOverlay | .mantine-ColorSwatch-colorOverlay | Overlay with given color background |
| childrenOverlay | .mantine-ColorSwatch-childrenOverlay | Overlay with `children` inside |
**ColorSwatch CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --cs-radius | Controls `border-radius` of all overlays and `root` element |
| root | --cs-size | Controls `width`, `height`, `min-width` and `min-height` of the `root` element |
--------------------------------------------------------------------------------
### Combobox
Package: @mantine/core
Import: import { Combobox } from '@mantine/core';
Description: Create custom select, autocomplete or multiselect inputs
## Examples
This page contains only a small set of examples, as the full code of the demos is long.
You can find all 50+ examples on a [separate page](https://mantine.dev/combobox?e=BasicSelect).
border-radius
in px |
| arrowSize | number | - | Arrow size in px |
| children | React.ReactNode | - | Combobox content |
| disabled | boolean | - | If set, popover dropdown will not be rendered |
| dropdownPadding | Paddingpadding
of the dropdown |
| floatingStrategy | FloatingStrategy | - | Changes floating ui [position strategy](https://floating-ui.com/docs/usefloating#strategy) |
| hideDetached | boolean | - | If set, the dropdown is hidden when the element is hidden with styles or not visible on the screen |
| keepMounted | boolean | - | If set, the dropdown is not unmounted from the DOM when hidden. display: none
styles are added instead. |
| middlewares | PopoverMiddlewares | - | Floating ui middlewares to configure position handling |
| offset | number | FloatingAxesOffsets | - | Offset of the dropdown element |
| onClose | (() => void) | - | Called when dropdown closes |
| onDismiss | (() => void) | - | Called when the popover is dismissed by clicking outside or by pressing escape |
| onEnterTransitionEnd | (() => void) | - | Called when enter transition ends |
| onExitTransitionEnd | (() => void) | - | Called when exit transition ends |
| onOpen | (() => void) | - | Called when dropdown opens |
| onOptionSubmit | ((value: string, optionProps: ComboboxOptionProps) => void) | - | Called when item is selected with the Enter
key or by clicking it |
| onPositionChange | ((position: FloatingPosition) => void) | - | Called when dropdown position changes |
| overlayProps | (OverlayProps & ElementProps<"div">) | - | Props passed down to Overlay
component |
| portalProps | BasePortalProps | - | Props to pass down to the Portal
when withinPortal
is true |
| position | FloatingPosition | - | Dropdown position relative to the target element |
| positionDependencies | any[] | - | @deprecated : Do not use, will be removed in 9.0 |
| preventPositionChangeWhenVisible | boolean | - | Prevents popover from flipping/shifting when it the dropdown is visible |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius |
| readOnly | boolean | - | Determines whether the Combobox
value can be changed |
| resetSelectionOnOptionHover | boolean | - | Determines whether selection should be reset when option is hovered |
| returnFocus | boolean | - | Determines whether focus should be automatically returned to control when dropdown closes |
| shadow | MantineShadow | - | Key of theme.shadows
or any other valid CSS box-shadow
value |
| size | MantineSize | (string & {}) | - | Controls items font-size
and padding
|
| store | ComboboxStore | - | Combobox store, can be used to control combobox state |
| transitionProps | TransitionProps | - | Props passed down to the Transition
component. Use to configure duration and animation type. |
| width | PopoverWidth | - | Dropdown width, or 'target'
to make dropdown width the same as target element |
| withArrow | boolean | - | Determines whether component should have an arrow |
| withOverlay | boolean | - | Determines whether the overlay should be displayed when the dropdown is opened |
| withinPortal | boolean | - | Determines whether dropdown should be rendered within the Portal
|
| zIndex | string | number | - | Dropdown z-index
|
#### Styles API
Combobox component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Combobox selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| options | .mantine-Combobox-options | `Combobox.Options` component |
| dropdown | .mantine-Combobox-dropdown | `Combobox.Dropdown` component |
| option | .mantine-Combobox-option | `Combobox.Option` component |
| search | .mantine-Combobox-search | `Combobox.Search` input |
| empty | .mantine-Combobox-empty | `Combobox.Empty` component |
| header | .mantine-Combobox-header | `Combobox.Header` component |
| footer | .mantine-Combobox-footer | `Combobox.Footer` component |
| group | .mantine-Combobox-group | `Combobox.Group` component |
| groupLabel | .mantine-Combobox-groupLabel | Label of `Combobox.Group` component |
**Combobox CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| dropdown | --combobox-option-fz | Controls option `font-size` |
| dropdown | --combobox-option-padding | Controls option `padding` |
| dropdown | --combobox-padding | Controls dropdown `padding` |
**Combobox data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| option | data-combobox-selected | Option is selected | - |
| option | data-combobox-active | - | - |
| option | data-combobox-disabled | - | - |
| dropdown | data-hidden | - | - |
--------------------------------------------------------------------------------
### Container
Package: @mantine/core
Import: import { Container } from '@mantine/core';
Description: Center content with padding and max-width
## Grid strategy
Starting from 8.2.0, `Container` supports `strategy="grid"` prop which enables more
features.
Differences from the default `strategy="block"`:
* Uses `display: grid` instead of `display: block`
* Does not include default inline padding
* Does not set `max-width` on the root element (uses grid template columns instead)
Features supported by `strategy="grid"`:
* Everything that is supported by `strategy="block"`
* Children with `data-breakout` attribute take the entire width of the container's parent element
* Children with `data-container` inside `data-breakout` have the same width as the main grid column
Example of using breakout feature:
#### Example: breakout
```tsx
import { Box, Container } from '@mantine/core';
function Demo() {
return (
size
prop is ignored. |
| size | number | MantineSize | (string & {}) | - | max-width
of the container, value is not responsive β it is the same for all screen sizes. Numbers are converted to rem. Ignored when fluid
prop is set. |
| strategy | "block" | "grid" | - | Centering strategy |
#### Styles API
Container component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Container selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Container-root | Root element |
**Container CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --container-size | Controls container `max-width` |
--------------------------------------------------------------------------------
### CopyButton
Package: @mantine/core
Import: import { CopyButton } from '@mantine/core';
Description: Copies given text to clipboard
## Usage
`CopyButton` is based on [use-clipboard](https://mantine.dev/hooks/use-clipboard/) hook.
Its children is a function that receives an object with the following properties:
* `copied` β boolean value that indicates that a given value was recently copied to the clipboard, it resets after a given timeout (defaults to 500ms)
* `copy` β function that should be called to copy given value to clipboard
#### Example: usage
```tsx
import { CopyButton, Button } from '@mantine/core';
function Demo() {
return (
display: none
styles are applied instead |
| onClose | (() => void) | - | Called when the close button is clicked |
| opened | boolean | required | Opened state |
| portalProps | BasePortalProps | - | Props passed down to the Portal
component. Ignored when withinPortal
is false
. |
| position | AffixPosition | - | Affix position on screen |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius, numbers are converted to rem |
| shadow | MantineShadow | - | Key of theme.shadows
or any valid CSS value to set box-shadow
|
| size | number | MantineSize | (string & {}) | - | Controls width
of the dialog |
| transitionProps | TransitionProps | - | Props passed down to the underlying Transition
component |
| withBorder | boolean | - | Adds border to the root element |
| withCloseButton | boolean | - | If set, the close button is displayed |
| withinPortal | boolean | - | Determines whether the component is rendered within Portal
|
| zIndex | React.CSSProperties["zIndex"] | - | Root element z-index
property |
#### Styles API
Dialog component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Dialog selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Dialog-root | Root element |
| closeButton | .mantine-Dialog-closeButton | Close button |
**Dialog CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --dialog-size | Controls `width` of the dialog |
--------------------------------------------------------------------------------
### Divider
Package: @mantine/core
Import: import { Divider } from '@mantine/core';
Description: Horizontal line with optional label or vertical divider
## Usage
#### Example: usage
```tsx
import { Text, Divider } from '@mantine/core';
function Demo() {
return (
<>
theme.colors
or any valid CSS color value, by default value depends on color scheme |
| label | React.ReactNode | - | Divider label, visible only when orientation
is horizontal
|
| labelPosition | "center" | "left" | "right" | - | Controls label position |
| orientation | "horizontal" | "vertical" | - | Controls orientation |
| size | number | MantineSize | (string & {}) | - | Controls width/height (depends on orientation) |
#### Styles API
Divider component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Divider selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Divider-root | Root element |
| label | .mantine-Divider-label | Label element |
**Divider CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --divider-border-style | Controls `border-style` |
| root | --divider-color | Controls `border-color` |
| root | --divider-size | Controls `border-width` |
**Divider data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-with-label | - | - |
| root | data-orientation | - | Value of |
| label | data-position | - | Value of |
--------------------------------------------------------------------------------
### Drawer
Package: @mantine/core
Import: import { Drawer } from '@mantine/core';
Description: Display overlay area at any side of the screen
## Usage
#### Example: usage
```tsx
import { useDisclosure } from '@mantine/hooks';
import { Drawer, Button } from '@mantine/core';
function Demo() {
const [opened, { open, close }] = useDisclosure(false);
return (
<>
Drawer with scroll
); return ( <>Drawer with scroll
); return ( <>onClose
is called when user presses the escape key |
| id | string | - | Id used to connect modal/drawer with body and title |
| keepMounted | boolean | - | If set modal/drawer is not unmounted from the DOM when hidden. display: none
styles are applied instead. |
| lockScroll | boolean | - | If set, scroll is locked when opened={true}
|
| offset | string | number | - | Drawer container offset from the viewport end |
| onClose | () => void | required | Called when modal/drawer is closed |
| onEnterTransitionEnd | (() => void) | - | Called when enter transition ends |
| onExitTransitionEnd | (() => void) | - | Called when exit transition ends |
| opened | boolean | required | Controls opened state |
| overlayProps | ModalBaseOverlayProps | - | Props passed down to the Overlay
component, can be used to configure opacity, background-color
, styles and other properties |
| padding | MantineSpacing | - | Key of theme.spacing
or any valid CSS value to set content, header and footer padding |
| portalProps | BasePortalProps | - | Props passed down to the Portal component when withinPortal
is set |
| position | DrawerPosition | - | Side of the screen on which drawer will be opened |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| removeScrollProps | RemoveScrollProps | - | Props passed down to react-remove-scroll, can be used to customize scroll lock behavior |
| returnFocus | boolean | - | If set, focus is returned to the last active element when onClose
is called |
| scrollAreaComponent | ScrollAreaComponent | - | Scroll area component |
| shadow | MantineShadow | - | Key of theme.shadows
or any valid CSS box-shadow value |
| size | number | MantineSize | (string & {}) | - | Controls width of the content area |
| stackId | string | - | Id of the drawer in the Drawer.Stack
|
| title | React.ReactNode | - | Drawer title |
| transitionProps | TransitionProps | - | Props added to the Transition
component that used to animate overlay and body, use to configure duration and animation type, { duration: 200, transition: 'fade-down' }
by default |
| trapFocus | boolean | - | If set, focus is trapped within the modal/drawer |
| withCloseButton | boolean | - | If set, the close button is displayed |
| withOverlay | boolean | - | If set, the overlay is displayed |
| withinPortal | boolean | - | If set, the component is rendered inside Portal
|
| zIndex | string | number | - | z-index
CSS property of the root element |
#### Styles API
Drawer component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Drawer selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Drawer-root | Root element |
| inner | .mantine-Drawer-inner | Element used to center modal, has fixed position, takes entire screen |
| content | .mantine-Drawer-content | `Drawer.Content` root element |
| header | .mantine-Drawer-header | Contains title and close button |
| overlay | .mantine-Drawer-overlay | Overlay displayed under the `Drawer.Content` |
| title | .mantine-Drawer-title | Drawer title (h2 tag), displayed in the header |
| body | .mantine-Drawer-body | Drawer body, displayed after header |
| close | .mantine-Drawer-close | Close button |
**Drawer CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --drawer-offset | Controls `margin` of `Drawer.Content` |
| root | --drawer-size | Controls `width` of `Drawer.Content` |
| root | --drawer-flex | Controls `flex` property of `Drawer.Content` |
| root | --drawer-align | Controls `align-items` property of `Drawer.Content` |
| root | --drawer-justify | Controls `justify-content` property of `Drawer.Content` |
| root | --drawer-height | Controls `height` property of `Drawer.Content` |
--------------------------------------------------------------------------------
### Fieldset
Package: @mantine/core
Import: import { Fieldset } from '@mantine/core';
Description: Group related elements in a form
## Usage
#### Example: usage
```tsx
import { Fieldset, TextInput } from '@mantine/core';
function Demo() {
return (
);
}
```
## Disabled
Set `disabled` prop to disable all inputs and buttons inside the fieldset:
#### Example: disabled
```tsx
import { Fieldset, TextInput, Button, Group } from '@mantine/core';
function Demo() {
return (
);
}
```
#### Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| legend | React.ReactNode | - | Fieldset legend |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
#### Styles API
Fieldset component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Fieldset selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Fieldset-root | Root element |
| legend | .mantine-Fieldset-legend | Legend element |
**Fieldset CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --fieldset-radius | Controls `border-radius` |
--------------------------------------------------------------------------------
### FileButton
Package: @mantine/core
Import: import { FileButton } from '@mantine/core';
Description: Open file picker with a button click
## Usage
#### Example: usage
```tsx
import { useState } from 'react';
import { FileButton, Button, Group, Text } from '@mantine/core';
function Demo() {
const [file, setFile] = useState-
{files.map((file, index) => (
- {file.name} ))}
"image/png,image/jpeg"
|
| capture | boolean | "user" | "environment" | - | Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. |
| children | (props: { onClick: () => void; }) => ReactNode | required | Function that receives button props and returns react node that should be rendered |
| disabled | boolean | - | Disables file picker |
| form | string | - | Input form attribute |
| inputProps | React.ComponentPropsWithoutRef<"input"> | - | Passes down props to the input element used to capture files |
| multiple | boolean | - | If set, user can pick more than one file |
| name | string | - | Input name attribute |
| onChange | (payload: Multiple extends true ? File[] : File | null) => void | required | Called when files are picked |
| resetRef | ForwardedRef<() => void> | - | Reference of the function that should be called when value changes to null or empty array |
--------------------------------------------------------------------------------
### FileInput
Package: @mantine/core
Import: import { FileInput } from '@mantine/core';
Description: Capture files from user
## Usage
"image/png,image/jpeg"
|
| capture | boolean | "user" | "environment" | - | Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. |
| clearButtonProps | React.ComponentPropsWithoutRef<"button"> | - | Props passed down to the clear button |
| clearable | boolean | - | If set, the clear button is displayed in the right section |
| defaultValue | File | File[] | null | - | Uncontrolled component default value |
| description | React.ReactNode | - | Contents of Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| fileInputProps | React.ComponentPropsWithoutRef<"input"> | - | Props passed down to the hidden input element which is used to capture files |
| form | string | - | Input form attribute |
| inputContainer | ((children: ReactNode) => ReactNode) | - | Input container component |
| inputSize | string | - | size
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| multiple | boolean | - | If set, user can pick more than one file |
| name | string | - | Input name attribute |
| onChange | ((payload: Multiple extends true ? File[] : File | null) => void) | - | Called when value changes |
| placeholder | React.ReactNode | - | Input placeholder |
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| readOnly | boolean | - | If set, the input value cannot be changed |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| resetRef | ForwardedRef<() => void> | - | Reference of the function that should be called when value changes to null or empty array |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| value | File | File[] | null | - | Controlled component value |
| valueComponent | FC<{ value: File | File[] | null; }> | - | Value renderer. By default, displays file name. |
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
FileInput component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**FileInput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-FileInput-wrapper | Root element of the Input |
| input | .mantine-FileInput-input | Input element |
| section | .mantine-FileInput-section | Left and right sections |
| root | .mantine-FileInput-root | Root element |
| label | .mantine-FileInput-label | Label element |
| required | .mantine-FileInput-required | Required asterisk element, rendered inside label |
| description | .mantine-FileInput-description | Description element |
| error | .mantine-FileInput-error | Error element |
| placeholder | .mantine-FileInput-placeholder | Placeholder text |
--------------------------------------------------------------------------------
### Flex
Package: @mantine/core
Import: import { Flex } from '@mantine/core';
Description: Compose elements in a flex container
## Usage
#### Example: configurator
```tsx
import { Flex, Button } from '@mantine/core';
function Demo() {
return (
align-items
CSS property |
| columnGap | StylePropcolumn-gap
CSS property |
| direction | StylePropflex-direction
CSS property |
| gap | StylePropgap
CSS property |
| justify | StylePropjustify-content
CSS property |
| rowGap | StyleProprow-gap
CSS property |
| wrap | StylePropflex-wrap
CSS property |
#### Styles API
Flex component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Flex selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Flex-root | Root element |
--------------------------------------------------------------------------------
### FloatingIndicator
Package: @mantine/core
Import: import { FloatingIndicator } from '@mantine/core';
Description: Display a floating indicator over a group of elements
## Usage
`FloatingIndicator` is designed to highlight active element in a group.
It can be used to create custom segmented controls, tabs and other similar components.
`FloatingIndicator` renders an element over the `target` element. To calculate the position it is
required to pass `parent` element which has a relative position.
By default, `FloatingIndicator` does not have any visible styles. You can use `className` prop
or [Styles API](https://mantine.dev/styles/styles-api) to apply styles.
#### Example: segmented
```tsx
import { useState } from 'react';
import { FloatingIndicator, UnstyledButton } from '@mantine/core';
import classes from './Demo.module.css';
const data = ['React', 'Vue', 'Angular', 'Svelte'];
function Demo() {
const [rootRef, setRootRef] = useStatetransform: scale(n)
styles. |
| parent | HTMLElement | null | required | Parent element with relative position based on which indicator position is calculated |
| target | HTMLElement | null | required | Target element over which indicator is displayed |
| transitionDuration | string | number | - | Transition duration in ms |
#### Styles API
FloatingIndicator component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**FloatingIndicator selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-FloatingIndicator-root | Root element |
**FloatingIndicator CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --transition-duration | Controls indicator transition duration |
--------------------------------------------------------------------------------
### FocusTrap
Package: @mantine/core
Import: import { FocusTrap } from '@mantine/core';
Description: Trap focus at child node
## Usage
FocusTrap is a component implementation of [use-focus-trap](https://mantine.dev/hooks/use-focus-trap/) hook,
it is used in all Mantine components that require focus trap ([Modal](https://mantine.dev/core/modal/), [DatePicker](https://mantine.dev/dates/date-picker/), [Popover](https://mantine.dev/core/popover/), etc.).
#### Example: usage
```tsx
import { useDisclosure } from '@mantine/hooks';
import { FocusTrap, TextInput, Button, Box } from '@mantine/core';
function Demo() {
const [active, { toggle }] = useDisclosure(false);
return (
false
, disables focus trap |
| children | any | required | Element to trap focus at, must support ref prop |
| innerRef | ForwardedRefalign-items
|
| breakpoints | GridBreakpoints | - | Breakpoints values, only used with type="container"
|
| columns | number | - | Number of columns in each row |
| grow | boolean | - | If set, columns in the last row expand to fill all available space |
| gutter | StyleProptheme.spacing
or any valid CSS value |
| justify | JustifyContent | - | Sets justify-content
|
| overflow | Overflow | - | Sets overflow
CSS property on the root element |
| type | "media" | "container" | - | Type of queries used for responsive styles |
#### Styles API
Grid component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Grid selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| container | .mantine-Grid-container | Container element, only used with `type="container"` prop |
| root | .mantine-Grid-root | Root element |
| inner | .mantine-Grid-inner | Columns wrapper |
| col | .mantine-Grid-col | `Grid.Col` root element |
**Grid CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --grid-overflow | Controls `overflow` property |
| root | --grid-align | Controls `align-items` property |
| root | --grid-justify | Controls `justify-content` property |
--------------------------------------------------------------------------------
### Group
Package: @mantine/core
Import: import { Group } from '@mantine/core';
Description: Compose elements and components in a horizontal flex container
## Usage
`Group` is a horizontal flex container. If you need a vertical flex container, use [Stack](https://mantine.dev/core/stack)
component instead. If you need to have full control over flex container properties, use [Flex](https://mantine.dev/core/flex) component.
#### Example: usage
```tsx
import { Group, Button } from '@mantine/core';
function Demo() {
return (
align-items
CSS property |
| gap | MantineSpacing | - | Key of theme.spacing
or any valid CSS value for gap
, numbers are converted to rem |
| grow | boolean | - | Determines whether each child element should have flex-grow: 1
style |
| justify | JustifyContent | - | Controls justify-content
CSS property |
| preventGrowOverflow | boolean | - | Determines whether children should take only dedicated amount of space (max-width
style is set based on the number of children) |
| wrap | FlexWrap | - | Controls flex-wrap
CSS property |
#### Styles API
Group component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Group selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Group-root | Root element |
**Group CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --group-align | Controls `align-items` property |
| root | --group-justify | Controls `justify-content` property |
| root | --group-gap | Controls `gap` property |
| root | --group-wrap | Controls `flex-wrap` property |
**Group data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-grow | - | - |
--------------------------------------------------------------------------------
### Highlight
Package: @mantine/core
Import: import { Highlight } from '@mantine/core';
Description: Highlight given part of a string with mark
## Usage
Use Highlight component to highlight a substring in a given string with a mark tag.
Pass the main string as children to Highlight component and string part that should be highlighted to `highlight` prop.
If the main string does not include `highlight` part, it will be ignored.
`Highlight` ignores trailing whitespace and highlights all matched characters sequences.
#### Example: usage
```tsx
import { Highlight } from '@mantine/core';
function Demo() {
return (
theme.colors
or any valid CSS color, passed to Mark
component color
prop |
| gradient | MantineGradient | - | Gradient configuration, ignored when variant
is not gradient
|
| highlight | string | string[] | required | Substring or a list of substrings to highlight in children
|
| highlightStyles | CSSProperties | ((theme: MantineTheme) => CSSProperties) | - | Styles applied to mark
elements |
| inherit | boolean | - | Determines whether font properties should be inherited from the parent |
| inline | boolean | - | Sets line-height
to 1 for centering |
| lineClamp | number | - | Number of lines after which Text will be truncated |
| size | MantineSize | (string & {}) | - | Controls font-size
and line-height
|
| span | boolean | - | Shorthand for component="span"
|
| truncate | TextTruncate | - | Side on which Text must be truncated, if true
, text is truncated from the start |
#### Styles API
Highlight component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Highlight selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Highlight-root | Root element |
--------------------------------------------------------------------------------
### HoverCard
Package: @mantine/core
Import: import { HoverCard } from '@mantine/core';
Description: Display popover section when target element is hovered
## Usage
#### Example: usage
```tsx
import { HoverCard, Button, Text, Group } from '@mantine/core';
function Demo() {
return (
border-radius
in px |
| arrowSize | number | - | Arrow size in px |
| children | React.ReactNode | - | Popover.Target
and Popover.Dropdown
components |
| clickOutsideEvents | string[] | - | Events that trigger outside clicks |
| closeDelay | number | - | Close delay in ms |
| closeOnClickOutside | boolean | - | Determines whether dropdown should be closed on outside clicks |
| closeOnEscape | boolean | - | Determines whether dropdown should be closed when Escape
key is pressed |
| defaultOpened | boolean | - | Initial opened state for uncontrolled component |
| disabled | boolean | - | If set, popover dropdown will not be rendered |
| floatingStrategy | FloatingStrategy | - | Changes floating ui [position strategy](https://floating-ui.com/docs/usefloating#strategy) |
| hideDetached | boolean | - | If set, the dropdown is hidden when the element is hidden with styles or not visible on the screen |
| id | string | - | Id base to create accessibility connections |
| initiallyOpened | boolean | - | Initial opened state |
| keepMounted | boolean | - | If set, the dropdown is not unmounted from the DOM when hidden. display: none
styles are added instead. |
| middlewares | PopoverMiddlewares | - | Floating ui middlewares to configure position handling |
| offset | number | FloatingAxesOffsets | - | Offset of the dropdown element |
| onClose | (() => void) | - | Called when the dropdown is closed |
| onDismiss | (() => void) | - | Called when the popover is dismissed by clicking outside or by pressing escape |
| onEnterTransitionEnd | (() => void) | - | Called when enter transition ends |
| onExitTransitionEnd | (() => void) | - | Called when exit transition ends |
| onOpen | (() => void) | - | Called when the dropdown is opened |
| onPositionChange | ((position: FloatingPosition) => void) | - | Called when dropdown position changes |
| openDelay | number | - | Open delay in ms |
| overlayProps | (OverlayProps & ElementProps<"div">) | - | Props passed down to Overlay
component |
| portalProps | BasePortalProps | - | Props to pass down to the Portal
when withinPortal
is true |
| position | FloatingPosition | - | Dropdown position relative to the target element |
| positionDependencies | any[] | - | @deprecated : Do not use, will be removed in 9.0 |
| preventPositionChangeWhenVisible | boolean | - | Prevents popover from flipping/shifting when it the dropdown is visible |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius |
| returnFocus | boolean | - | Determines whether focus should be automatically returned to control when dropdown closes |
| shadow | MantineShadow | - | Key of theme.shadows
or any other valid CSS box-shadow
value |
| transitionProps | TransitionProps | - | Props passed down to the Transition
component. Use to configure duration and animation type. |
| trapFocus | boolean | - | Determines whether focus should be trapped within dropdown |
| width | PopoverWidth | - | Dropdown width, or 'target'
to make dropdown width the same as target element |
| withArrow | boolean | - | Determines whether component should have an arrow |
| withOverlay | boolean | - | Determines whether the overlay should be displayed when the dropdown is opened |
| withRoles | boolean | - | Determines whether dropdown and target elements should have accessible roles |
| withinPortal | boolean | - | Determines whether dropdown should be rendered within the Portal
|
| zIndex | string | number | - | Dropdown z-index
|
--------------------------------------------------------------------------------
### Image
Package: @mantine/core
Import: import { Image } from '@mantine/core';
Description: Image with optional fallback
## Usage
`Image` is a wrapper for `img` with minimal styles. By default, the image
will take 100% of parent width. The image size can be controlled with `w`
and `h` [style props](https://mantine.dev/styles/style-props).
#### Example: usage
```tsx
import { Image } from '@mantine/core';
function Demo() {
return (
object-fit
style |
| onError | ((event: SyntheticEventtheme.radius
or any valid CSS value to set border-radius
|
| src | any | - | Image url |
#### Styles API
Image component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Image selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Image-root | Root element |
**Image CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --image-object-fit | Controls `object-fit` property |
| root | --image-radius | Controls `border-radius` property |
**Image data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-fallback | Image failed to load | - |
--------------------------------------------------------------------------------
### Indicator
Package: @mantine/core
Import: import { Indicator } from '@mantine/core';
Description: Display element at the corner of another element
## Usage
#### Example: configurator
```tsx
import { Indicator, Avatar } from '@mantine/core';
function Demo() {
return (
filled
variant |
| color | MantineColor | - | Key of theme.colors
or any valid CSS color value |
| disabled | boolean | - | If set, the indicator is hidden |
| inline | boolean | - | Determines whether the indicator container should be an inline element |
| label | React.ReactNode | - | Label displayed inside the indicator, for example, notification count |
| offset | number | - | Indicator offset relative to the target element, usually used for elements with border-radius |
| position | "bottom-end" | "bottom-start" | "top-end" | "top-start" | "bottom-center" | "top-center" | "middle-center" | "middle-end" | "middle-start" | - | Indicator position relative to the target element |
| processing | boolean | - | If set, the indicator has processing animation |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| size | string | number | - | Indicator width and height |
| withBorder | boolean | - | Adds border to the root element |
| zIndex | string | number | - | Indicator z-index |
#### Styles API
Indicator component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Indicator selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Indicator-root | Root element |
| indicator | .mantine-Indicator-indicator | Indicator element |
**Indicator CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --indicator-bottom | Controls `bottom` style |
| root | --indicator-left | Controls `left` style |
| root | --indicator-right | Controls `right` style |
| root | --indicator-top | Controls `top` style |
| root | --indicator-radius | Controls `border-radius` |
| root | --indicator-size | Controls `min-width` and `height` |
| root | --indicator-translate-x | Controls `translateX` style, used for positioning |
| root | --indicator-translate-y | Controls `translateY` style, used for positioning |
| root | --indicator-z-index | Controls `z-index` style |
| root | --indicator-color | Controls `background-color` |
| root | --indicator-text-color | Controls `color` |
**Indicator data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-inline | - | - |
| indicator | data-with-label | - | - |
| indicator | data-with-border | - | - |
| indicator | data-processing | - | - |
--------------------------------------------------------------------------------
### Input
Package: @mantine/core
Import: import { Input } from '@mantine/core';
Description: Base component to create custom inputs
## Disclaimer
**!important:** In most cases, you should not use `Input` in your application.
`Input` is a base for other inputs and was not designed to be used directly.
Use `Input` to create custom inputs, for other cases prefer [TextInput](https://mantine.dev/core/text-input/)
or other component.
```tsx
import { Input, TextInput } from '@mantine/core';
// Incorrect usage, input is not accessible
function Incorrect() {
return (
disabled
attribute on the input
element |
| error | React.ReactNode | - | Determines whether the input should have error styles and aria-invalid
attribute |
| id | string | - | Input element id |
| inputSize | string | - | size
attribute passed down to the input element |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| multiline | boolean | - | Determines whether the input can have multiple lines, for example when component="textarea"
|
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| required | boolean | - | Sets required
attribute on the input
element |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| withAria | boolean | - | Determines whether aria-
and other accessibility attributes should be added to the input |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| wrapperProps | WrapperProps | - | Props passed down to the root element of the Input
component |
#### Styles API
Input component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Input selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-Input-wrapper | Root element of the Input |
| input | .mantine-Input-input | Input element |
| section | .mantine-Input-section | Left and right sections |
**Input CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| wrapper | --input-fz | `font-size` of the input element |
| wrapper | --input-left-section-width | `width` of the left section |
| wrapper | --input-right-section-width | `width` of the right section |
| wrapper | --input-padding-y | `padding-top` and `padding-bottom` of the input element |
| wrapper | --input-radius | `border-radius` of the input element |
| wrapper | --input-left-section-pointer-events | Controls `pointer-events` of the left section |
| wrapper | --input-right-section-pointer-events | Controls `pointer-events` of the right section |
**Inputwrapper selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Inputwrapper-root | Root element |
| label | .mantine-Inputwrapper-label | Label element |
| required | .mantine-Inputwrapper-required | Required asterisk element, rendered inside label |
| description | .mantine-Inputwrapper-description | Description element |
| error | .mantine-Inputwrapper-error | Error element |
**Inputwrapper CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| label | --input-label-size | Controls label `font-size` |
| label | --input-asterisk-color | Controls label asterisk text `color` |
**Inputbase selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-Inputbase-wrapper | Root element of the Input |
| input | .mantine-Inputbase-input | Input element |
| section | .mantine-Inputbase-section | Left and right sections |
| root | .mantine-Inputbase-root | Root element |
| label | .mantine-Inputbase-label | Label element |
| required | .mantine-Inputbase-required | Required asterisk element, rendered inside label |
| description | .mantine-Inputbase-description | Description element |
| error | .mantine-Inputbase-error | Error element |
--------------------------------------------------------------------------------
### JsonInput
Package: @mantine/core
Import: import { JsonInput } from '@mantine/core';
Description: Capture json data from user
## Usage
`JsonInput` is based on [Textarea](https://mantine.dev/core/textarea/) component,
it includes json validation logic and option to format input value on blur:
#### Example: usage
```tsx
import { JsonInput } from '@mantine/core';
function Demo() {
return (
Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| deserialize | ((text: string, reviver?: ((this: any, key: string, value: any) => any)) => any) | undefined | - | Function to deserialize string value, used for value formatting and input JSON validation, must throw error if string cannot be processed |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| formatOnBlur | boolean | - | Determines whether the value should be formatted on blur |
| inputContainer | ((children: ReactNode) => ReactNode) | - | Input container component |
| inputSize | string | - | size
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| maxRows | number | - | Maximum rows for autosize textarea to grow, ignored if autosize
prop is not set |
| minRows | number | - | Minimum rows of autosize textarea, ignored if autosize
prop is not set |
| onChange | ((value: string) => void) | - | Called when value changes |
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| resize | Resize | - | Controls resize
CSS property |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| serialize | { (value: any, replacer?: ((this: any, key: string, value: any) => any), space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | ... 1 more ... | undefined): string; } | undefined | - | Function to serialize value into a string, used for value formatting |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| validationError | React.ReactNode | - | Error message displayed when value is not valid JSON |
| value | string | - | Controlled component value |
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
JsonInput component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**JsonInput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-JsonInput-wrapper | Root element of the Input |
| input | .mantine-JsonInput-input | Input element |
| section | .mantine-JsonInput-section | Left and right sections |
| root | .mantine-JsonInput-root | Root element |
| label | .mantine-JsonInput-label | Label element |
| required | .mantine-JsonInput-required | Required asterisk element, rendered inside label |
| description | .mantine-JsonInput-description | Description element |
| error | .mantine-JsonInput-error | Error element |
--------------------------------------------------------------------------------
### Kbd
Package: @mantine/core
Import: import { Kbd } from '@mantine/core';
Description: Display keyboard key
## Usage
## Size
#### Example: size
```tsx
import { Kbd } from '@mantine/core';
function Demo() {
return Shift;
}
```
#### Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| size | number | MantineSize | (string & {}) | - | Controls font-size
and padding
|
#### Styles API
Kbd component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Kbd selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Kbd-root | Root element |
**Kbd CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --kbd-fz | Controls `font-size` |
--------------------------------------------------------------------------------
### List
Package: @mantine/core
Import: import { List } from '@mantine/core';
Description: Display ordered or unordered list
## Usage
#### Example: configurator
```tsx
import { List } from '@mantine/core';
function Demo() {
return (
List.Item
components |
| icon | React.ReactNode | - | Icon to replace list item dot |
| listStyleType | ListStyleType | - | Controls list-style-type
, by default inferred from type
|
| size | MantineSize | - | Controls font-size
and line-height
|
| spacing | MantineSpacing | - | Key of theme.spacing
or any valid CSS value to set spacing between items |
| type | "ordered" | "unordered" | - | List type |
| withPadding | boolean | - | Determines whether list items should be offset with padding |
#### Styles API
List component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**List selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-List-root | Root element |
| item | .mantine-List-item | ListItem root element |
| itemIcon | .mantine-List-itemIcon | ListItem icon |
| itemLabel | .mantine-List-itemLabel | ListItem content |
| itemWrapper | .mantine-List-itemWrapper | ListItem wrapper element, container, icon and content |
**List CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --list-fz | Controls `font-size` |
| root | --list-lh | Controls `line-height` |
| root | --list-spacing | Controls spacing between items |
**List data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-with-padding | - | - |
| item | data-centered | - | - |
| item | data-with-icon | - | - |
--------------------------------------------------------------------------------
### Loader
Package: @mantine/core
Import: import { Loader } from '@mantine/core';
Description: Indicate loading state
## Usage
`Loader` component supports 3 types of loaders: `oval`, `bars` and `dots` by default. All
loaders are animated with CSS for better performance.
#### Example: configurator
```tsx
import { Loader } from '@mantine/core';
function Demo() {
return theme.colors
or any valid CSS color |
| loaders | Partialwidth
and height
of the loader. Loader
has predefined xs
-xl
values. Numbers are converted to rem. |
| type | (string & {}) | "bars" | "dots" | "oval" | - | Loader type, key of loaders
prop |
#### Styles API
Loader component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Loader selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Loader-root | Root element |
**Loader CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --loader-color | Control loader color |
--------------------------------------------------------------------------------
### LoadingOverlay
Package: @mantine/core
Import: import { LoadingOverlay } from '@mantine/core';
Description: An overlay with centered loader
## Usage
`LoadingOverlay` renders an overlay with a loader over the parent element with relative position.
It is usually used to indicate loading state of forms.
Note that elements under overlay are still focusable with keyboard, remember to add additional logic to handle this case.
`LoadingOverlay` rendering is controlled by `visible` prop:
#### Example: usage
```tsx
import { useDisclosure } from '@mantine/hooks';
import { LoadingOverlay, Button, Group, Box } from '@mantine/core';
function Demo() {
const [visible, { toggle }] = useDisclosure(false);
// Note that position: relative is required
return (
<>
Loader
component |
| overlayProps | OverlayProps | - | Props passed down to Overlay
component |
| transitionProps | TransitionProps | - | Props passed down to Transition
component |
| visible | boolean | - | Determines whether the overlay should be visible |
| zIndex | string | number | - | Controls overlay z-index
|
#### Styles API
LoadingOverlay component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**LoadingOverlay selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-LoadingOverlay-root | Root element |
| overlay | .mantine-LoadingOverlay-overlay | `Overlay` component |
| loader | .mantine-LoadingOverlay-loader | `Loader` component |
**LoadingOverlay CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --lo-z-index | Controls `z-index` of the overlay and loader |
--------------------------------------------------------------------------------
### Mark
Package: @mantine/core
Import: import { Mark } from '@mantine/core';
Description: Highlight part of the text
## Usage
#### Example: usage
```tsx
import { Text, Mark } from '@mantine/core';
function Demo() {
return (
theme.colors
or any valid CSS color |
#### Styles API
Mark component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Mark selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Mark-root | Root element |
**Mark CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --mark-bg-dark | Controls `background-color` in dark color scheme |
| root | --mark-bg-light | Controls `background-color` for light color scheme |
--------------------------------------------------------------------------------
### Menu
Package: @mantine/core
Import: import { Menu } from '@mantine/core';
Description: Combine a list of secondary actions into single interactive area
## Usage
#### Example: usage
```tsx
import { Menu, Button, Text } from '@mantine/core';
import {
IconSettings,
IconSearch,
IconPhoto,
IconMessageCircle,
IconTrash,
IconArrowsLeftRight,
} from '@tabler/icons-react';
function Demo() {
return (
);
}
```
## Submenus
#### Example: sub
```tsx
import { Button, Menu } from '@mantine/core';
function Demo() {
return (
);
}
```
## Controlled
Dropdown opened state can be controlled with `opened` and `onChange` props:
```tsx
import { useState } from 'react';
import { Menu } from '@mantine/core';
function Demo() {
const [opened, setOpened] = useState(false);
return (
);
}
```
## Show menu on hover
Set `trigger="hover"` to reveal dropdown when hovers over menu target and dropdown.
`closeDelay` and `openDelay` props can be used to control open and close delay in ms.
Note that:
* If you set `closeDelay={0}` then menu will close before user will reach dropdown, set `offset={0}` to remove space between target element and dropdown.
* Menu with `trigger="hover"` is not accessible β users that navigate with keyboard will not be able to use it. If you need click-hover hover and click triggers, use `trigger="click-hover"`.
#### Example: hover
```tsx
import { Menu } from '@mantine/core';
function Demo() {
return (
);
}
```
To make `Menu` that is revealed on hover accessible on all devices, use `trigger="click-hover"` instead.
The dropdown will be revealed on hover on desktop and on click on mobile devices.
#### Example: clickHover
```tsx
import { Menu } from '@mantine/core';
function Demo() {
return (
);
}
```
## Disabled items
#### Example: disabled
```tsx
import { Menu, Button } from '@mantine/core';
import { IconSearch } from '@tabler/icons-react';
function Demo() {
return (
);
}
```
## Dropdown position
#### Example: positionConfigurator
```tsx
import { Menu } from '@mantine/core';
function Demo() {
return (
);
}
```
## Transitions
Menu dropdown can be animated with any of premade transitions from [Transition](https://mantine.dev/core/transition/) component:
#### Example: transitions
```tsx
import { Menu } from '@mantine/core';
function Demo() {
return (
);
}
```
## Custom component as Menu.Item
By default, `Menu.Item` renders as button element, to change that set `component` prop:
#### Example: component
```tsx
import { Menu, Button } from '@mantine/core';
import { IconExternalLink } from '@tabler/icons-react';
function Demo() {
return (
);
}
```
Note that the component you pass to `component` prop should allow spreading props to its root element:
```tsx
import { Menu } from '@mantine/core';
// β Will not work with Menu.Item
function IncorrectItem() {
return ;
}
// β
Will work correctly with Menu.Item
const CorrectItem = forwardRef<
HTMLButtonElement,
React.ComponentPropsWithoutRef<'button'>
>((props, ref) => (
));
function Demo() {
// β Will not work
const incorrect = border-radius
in px |
| arrowSize | number | - | Arrow size in px |
| children | React.ReactNode | - | Menu children |
| clickOutsideEvents | string[] | - | Events that trigger outside clicks |
| closeDelay | number | - | Close delay in ms, applicable only to trigger="hover"
variant |
| closeOnClickOutside | boolean | - | If set, the dropdown is closed on outside clicks |
| closeOnEscape | boolean | - | If set, the dropdown is closed when the Escape
key is pressed |
| closeOnItemClick | boolean | - | If set, the Menu is closed when one of the items is clicked |
| defaultOpened | boolean | - | Uncontrolled menu initial opened state |
| disabled | boolean | - | If set, popover dropdown will not be rendered |
| floatingStrategy | FloatingStrategy | - | Changes floating ui [position strategy](https://floating-ui.com/docs/usefloating#strategy) |
| hideDetached | boolean | - | If set, the dropdown is hidden when the element is hidden with styles or not visible on the screen |
| id | string | - | Id base to create accessibility connections |
| keepMounted | boolean | - | If set, the dropdown is not unmounted from the DOM when hidden. display: none
styles are added instead. |
| loop | boolean | - | If set, arrow key presses loop though items (first to last and last to first) |
| menuItemTabIndex | 0 | -1 | - | Set the tabindex
on all menu items |
| middlewares | PopoverMiddlewares | - | Floating ui middlewares to configure position handling |
| offset | number | FloatingAxesOffsets | - | Offset of the dropdown element |
| onChange | ((opened: boolean) => void) | - | Called when menu opened state changes |
| onClose | (() => void) | - | Called when Menu is closed |
| onDismiss | (() => void) | - | Called when the popover is dismissed by clicking outside or by pressing escape |
| onEnterTransitionEnd | (() => void) | - | Called when enter transition ends |
| onExitTransitionEnd | (() => void) | - | Called when exit transition ends |
| onOpen | (() => void) | - | Called when Menu is opened |
| onPositionChange | ((position: FloatingPosition) => void) | - | Called when dropdown position changes |
| openDelay | number | - | Open delay in ms, applicable only to trigger="hover"
variant |
| opened | boolean | - | Controlled menu opened state |
| overlayProps | (OverlayProps & ElementProps<"div">) | - | Props passed down to Overlay
component |
| portalProps | BasePortalProps | - | Props to pass down to the Portal
when withinPortal
is true |
| position | FloatingPosition | - | Dropdown position relative to the target element |
| positionDependencies | any[] | - | @deprecated : Do not use, will be removed in 9.0 |
| preventPositionChangeWhenVisible | boolean | - | Prevents popover from flipping/shifting when it the dropdown is visible |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius |
| returnFocus | boolean | - | Determines whether focus should be automatically returned to control when dropdown closes |
| shadow | MantineShadow | - | Key of theme.shadows
or any other valid CSS box-shadow
value |
| transitionProps | TransitionProps | - | Props passed down to the Transition
component. Use to configure duration and animation type. |
| trapFocus | boolean | - | If set, focus is trapped within the menu dropdown when it is opened |
| trigger | "hover" | "click" | "click-hover" | - | Event trigger to open menu |
| width | PopoverWidth | - | Dropdown width, or 'target'
to make dropdown width the same as target element |
| withArrow | boolean | - | Determines whether component should have an arrow |
| withInitialFocusPlaceholder | boolean | - | If set, focus placeholder element is added before items |
| withOverlay | boolean | - | Determines whether the overlay should be displayed when the dropdown is opened |
| withinPortal | boolean | - | Determines whether dropdown should be rendered within the Portal
|
| zIndex | string | number | - | Dropdown z-index
|
#### Styles API
Menu component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Menu selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| dropdown | .mantine-Menu-dropdown | Dropdown element |
| arrow | .mantine-Menu-arrow | Dropdown arrow |
| overlay | .mantine-Menu-overlay | Overlay element |
| divider | .mantine-Menu-divider | `Menu.Divider` root element |
| label | .mantine-Menu-label | `Menu.Label` root element |
| item | .mantine-Menu-item | `Menu.Item` root element |
| itemLabel | .mantine-Menu-itemLabel | Label of `Menu.Item` |
| itemSection | .mantine-Menu-itemSection | Left and right sections of `Menu.Item` |
| chevron | .mantine-Menu-chevron | Sub menu chevron |
**Menu data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| item | data-disabled | - | - |
--------------------------------------------------------------------------------
### Modal
Package: @mantine/core
Import: import { Modal } from '@mantine/core';
Description: An accessible overlay dialog
## Usage
#### Example: usage
```tsx
import { useDisclosure } from '@mantine/hooks';
import { Modal, Button } from '@mantine/core';
function Demo() {
const [opened, { open, close }] = useDisclosure(false);
return (
<>
Modal with scroll
); return ( <>Modal with scroll
); return ( <>onClose
is called when user presses the escape key |
| fullScreen | boolean | - | If set, the modal takes the entire screen |
| id | string | - | Id used to connect modal/drawer with body and title |
| keepMounted | boolean | - | If set modal/drawer is not unmounted from the DOM when hidden. display: none
styles are applied instead. |
| lockScroll | boolean | - | If set, scroll is locked when opened={true}
|
| onClose | () => void | required | Called when modal/drawer is closed |
| onEnterTransitionEnd | (() => void) | - | Called when enter transition ends |
| onExitTransitionEnd | (() => void) | - | Called when exit transition ends |
| opened | boolean | required | Controls opened state |
| overlayProps | ModalBaseOverlayProps | - | Props passed down to the Overlay
component, use to configure opacity, background-color
, styles and other properties |
| padding | MantineSpacing | - | Key of theme.spacing
or any valid CSS value to set content, header and footer padding |
| portalProps | BasePortalProps | - | Props passed down to the Portal component when withinPortal
is set |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| removeScrollProps | RemoveScrollProps | - | Props passed down to react-remove-scroll, can be used to customize scroll lock behavior |
| returnFocus | boolean | - | If set, focus is returned to the last active element when onClose
is called |
| scrollAreaComponent | ScrollAreaComponent | - | Scroll area component |
| shadow | MantineShadow | - | Key of theme.shadows
or any valid CSS box-shadow value |
| size | number | MantineSize | (string & {}) | - | Controls width of the content area |
| stackId | string | - | Id of the modal in the Modal.Stack
|
| title | React.ReactNode | - | Modal title |
| transitionProps | TransitionProps | - | Props added to the Transition
component that used to animate overlay and body, use to configure duration and animation type, { duration: 200, transition: 'fade-down' }
by default |
| trapFocus | boolean | - | If set, focus is trapped within the modal/drawer |
| withCloseButton | boolean | - | If set, the close button is rendered |
| withOverlay | boolean | - | If set, the overlay is rendered |
| withinPortal | boolean | - | If set, the component is rendered inside Portal
|
| xOffset | MarginLeftz-index
CSS property of the root element |
#### Styles API
Modal component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Modal selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Modal-root | Root element |
| inner | .mantine-Modal-inner | Element used to center modal, has fixed position, takes entire screen |
| content | .mantine-Modal-content | `Modal.Content` root element |
| header | .mantine-Modal-header | Contains title and close button |
| overlay | .mantine-Modal-overlay | Overlay displayed under the `Modal.Content` |
| title | .mantine-Modal-title | Modal title (h2 tag), displayed in the header |
| body | .mantine-Modal-body | Modal body, displayed after header |
| close | .mantine-Modal-close | Close button |
**Modal CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --modal-radius | Controls `border-radius` of `Modal.Content` |
| root | --modal-size | Controls `width` of `Modal.Content` |
**Modal data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-full-screen | - | - |
| root | data-centered | - | - |
--------------------------------------------------------------------------------
### MultiSelect
Package: @mantine/core
Import: import { MultiSelect } from '@mantine/core';
Description: Custom searchable multi select
Combobox
component |
| data | ComboboxData | - | Data used to generate options. Values must be unique, otherwise an error will be thrown and component will not render. |
| defaultDropdownOpened | boolean | - | Uncontrolled dropdown initial opened state |
| defaultSearchValue | string | - | Default search value |
| defaultValue | string[] | - | Uncontrolled component default value |
| description | React.ReactNode | - | Contents of Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| dropdownOpened | boolean | - | Controlled dropdown opened state |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| filter | OptionsFilter | - | Function based on which items are filtered and sorted |
| hiddenInputProps | React.ComponentPropsWithoutRef<"input"> | - | Props passed down to the hidden input |
| hiddenInputValuesDivider | string | - | Divider used to separate values in the hidden input value
attribute |
| hidePickedOptions | boolean | - | If set, picked options are removed from the options list |
| inputContainer | ((children: ReactNode) => ReactNode) | - | Input container component |
| inputSize | string | - | size
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| limit | number | - | Maximum number of options displayed at a time, Infinity
by default |
| maxDropdownHeight | string | number | - | max-height
of the dropdown, only applicable when withScrollArea
prop is true
, 250
by default |
| maxValues | number | - | Maximum number of values, no limit if not set |
| nothingFoundMessage | React.ReactNode | - | Message displayed when no option matches the current search query while the searchable
prop is set or there is no data |
| onChange | ((value: string[]) => void) | - | Called when value changes |
| onClear | (() => void) | - | Called when the clear button is clicked |
| onDropdownClose | (() => void) | - | Called when dropdown closes |
| onDropdownOpen | (() => void) | - | Called when dropdown opens |
| onOptionSubmit | ((value: string) => void) | - | Called when option is submitted from dropdown with mouse click or Enter
key |
| onRemove | ((value: string) => void) | - | Called with value
of the removed item |
| onSearchChange | ((value: string) => void) | - | Called when search changes |
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| renderOption | ((item: ComboboxLikeRenderOptionInputpointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| scrollAreaProps | ScrollAreaProps | - | Props passed down to the underlying ScrollArea
component in the dropdown |
| searchValue | string | - | Controlled search value |
| searchable | boolean | - | Allows searching |
| selectFirstOptionOnChange | boolean | - | If set, the first option is selected when value changes, false
by default |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| value | string[] | - | Controlled component value |
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withCheckIcon | boolean | - | If set, the check icon is displayed near the selected option label |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| withScrollArea | boolean | - | Determines whether the options should be wrapped with ScrollArea.AutoSize
, true
by default |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
MultiSelect component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**MultiSelect selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-MultiSelect-wrapper | Root element of the Input |
| input | .mantine-MultiSelect-input | Input element |
| section | .mantine-MultiSelect-section | Left and right sections |
| root | .mantine-MultiSelect-root | Root element |
| label | .mantine-MultiSelect-label | Label element |
| required | .mantine-MultiSelect-required | Required asterisk element, rendered inside label |
| description | .mantine-MultiSelect-description | Description element |
| error | .mantine-MultiSelect-error | Error element |
| pill | .mantine-MultiSelect-pill | Value pill |
| inputField | .mantine-MultiSelect-inputField | Input field |
| pillsList | .mantine-MultiSelect-pillsList | List of pills, also contains input field |
--------------------------------------------------------------------------------
### NativeSelect
Package: @mantine/core
Import: import { NativeSelect } from '@mantine/core';
Description: Native select element based on Input
## Usage
children
|
| description | React.ReactNode | - | Contents of Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| inputContainer | ((children: ReactNode) => ReactNode) | - | Input container component |
| inputSize | string | - | size
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
NativeSelect component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**NativeSelect selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-NativeSelect-root | Root element |
| label | .mantine-NativeSelect-label | Label element |
| required | .mantine-NativeSelect-required | Required asterisk element, rendered inside label |
| description | .mantine-NativeSelect-description | Description element |
| error | .mantine-NativeSelect-error | Error element |
| wrapper | .mantine-NativeSelect-wrapper | Root element of the Input |
| input | .mantine-NativeSelect-input | Input element |
| section | .mantine-NativeSelect-section | Left and right sections |
--------------------------------------------------------------------------------
### NavLink
Package: @mantine/core
Import: import { NavLink } from '@mantine/core';
Description: Navigation link
## Usage
#### Example: usage
```tsx
import { Badge, NavLink } from '@mantine/core';
import { IconHome2, IconGauge, IconChevronRight, IconActivity, IconCircleOff } from '@tabler/icons-react';
function Demo() {
return (
<>
filled
variant |
| children | React.ReactNode | - | Child NavLink
components |
| childrenOffset | MantineSpacing | - | Key of theme.spacing
or any valid CSS value to set collapsed links padding-left
|
| color | MantineColor | - | Key of theme.colors
of any valid CSS color to control active styles |
| defaultOpened | boolean | - | Uncontrolled nested items collapse initial state |
| description | React.ReactNode | - | Link description, displayed below the label |
| disableRightSectionRotation | boolean | - | If set, right section will not be rotated when collapse is opened |
| disabled | boolean | - | If set, disabled styles will be added to the root element |
| label | React.ReactNode | - | Main link label |
| leftSection | React.ReactNode | - | Section displayed on the left side of the label |
| noWrap | boolean | - | If set, label and description do not wrap to the next line |
| onChange | ((opened: boolean) => void) | - | Called when open state changes |
| opened | boolean | - | Controlled nested items collapse state |
| rightSection | React.ReactNode | - | Section displayed on the right side of the label |
#### Styles API
NavLink component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**NavLink selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-NavLink-root | Root element |
| body | .mantine-NavLink-body | Contains label and description |
| section | .mantine-NavLink-section | Left and right sections |
| label | .mantine-NavLink-label | NavLink label |
| description | .mantine-NavLink-description | Dimmed description displayed below the label |
| children | .mantine-NavLink-children | Wrapper around nested links |
| chevron | .mantine-NavLink-chevron | Default chevron icon |
| collapse | .mantine-NavLink-collapse | Nested links Collapse container |
**NavLink CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --nl-bg | Controls link `background-color` |
| root | --nl-color | Controls link `color` |
| root | --nl-hover | Controls link `background-color` when hovered |
**NavLink data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-active | - | - |
--------------------------------------------------------------------------------
### Notification
Package: @mantine/core
Import: import { Notification } from '@mantine/core';
Description: Show dynamic notifications and alerts to user, part of notifications system
## Usage
Notification is a base component for notification system.
Build your own or use [@mantine/notifications](https://mantine.dev/x/notifications/) package.
#### Example: configurator
```tsx
import { Notification } from '@mantine/core';
function Demo() {
return (
theme.colors
or any valid CSS color |
| icon | React.ReactNode | - | Notification icon, replaces color line |
| loaderProps | LoaderProps | - | Props passed down to the Loader
component |
| loading | boolean | - | If set, the Loader
component is displayed instead of the icon |
| onClose | (() => void) | - | Called when the close button is clicked |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| title | React.ReactNode | - | Notification title, displayed above the message body |
| withBorder | boolean | - | Adds border to the root element |
| withCloseButton | boolean | - | If set, the close button is visible |
#### Styles API
Notification component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Notification selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Notification-root | Root element |
| loader | .mantine-Notification-loader | Loader component, displayed only when `loading` prop is set |
| icon | .mantine-Notification-icon | Icon component, displayed only when `icon` prop is set |
| body | .mantine-Notification-body | Notification body, contains all other elements |
| title | .mantine-Notification-title | Title element, displayed only when `title` prop is set |
| description | .mantine-Notification-description | Description displayed below the title |
| closeButton | .mantine-Notification-closeButton | Close button element |
**Notification CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --notification-radius | Controls `border-radius` |
| root | --notification-color | Controls icon color or notification line color |
**Notification data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-with-icon | - | - |
| root | data-with-border | - | - |
| description | data-with-title | - | - |
**Notifications selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Notifications-root | Notifications container, contains all notifications |
| notification | .mantine-Notifications-notification | Single notification |
**Notifications CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --notifications-container-width | Controls notifications container `max-width` |
| root | --notifications-z-index | Controls notifications container `z-index` |
--------------------------------------------------------------------------------
### NumberFormatter
Package: @mantine/core
Import: import { NumberFormatter } from '@mantine/core';
Description: Format number with thousands/decimal separators and suffix/prefix
## Usage
Use `NumberFormatter` to format numbers. It supports the same formatting related props
as [NumberInput](https://mantine.dev/core/number-input/) component.
#### Example: usage
```tsx
import { NumberFormatter } from '@mantine/core';
function Demo() {
return '.'
by default |
| fixedDecimalScale | boolean | - | If set, zeros are added after decimalSeparator
to match given decimalScale
. |
| prefix | string | - | Prefix added before the value |
| suffix | string | - | Suffix added after the value |
| thousandSeparator | string | boolean | - | A character used to separate thousands |
| thousandsGroupStyle | "none" | "thousand" | "lakh" | "wan" | - | Defines the thousand grouping style |
| value | string | number | - | Value to format |
--------------------------------------------------------------------------------
### NumberInput
Package: @mantine/core
Import: import { NumberInput } from '@mantine/core';
Description: Capture number from user
## Usage
`NumberInput` is based on [react-number-format](https://www.npmjs.com/package/react-number-format).
It supports most of the props from the `NumericFormat` component in the original package.
false
, leading zeros are removed when the input value becomes a valid number. |
| allowNegative | boolean | - | If set, negative values are allowed |
| allowedDecimalSeparators | string[] | - | Characters which when pressed result in a decimal separator |
| clampBehavior | "none" | "blur" | "strict" | - | Controls how value is clamped, strict
β user is not allowed to enter values that are not in [min, max]
range, blur
β user is allowed to enter any values, but the value is clamped when the input loses focus (default behavior), none
β lifts all restrictions, [min, max]
range is applied only for controls and up/down keys |
| decimalScale | number | - | Limits the number of digits that can be entered after the decimal point |
| decimalSeparator | string | - | Character used as a decimal separator |
| defaultValue | string | number | - | Uncontrolled component default value |
| description | React.ReactNode | - | Contents of Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| fixedDecimalScale | boolean | - | If set, 0s are added after decimalSeparator
to match given decimalScale
. |
| handlersRef | ForwardedRefsize
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| isAllowed | ((values: NumberFormatValues) => boolean) | - | A function to validate the input value. If this function returns false
, the onChange
will not be called and the input value will not change. |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| max | number | - | Maximum possible value |
| min | number | - | Minimum possible value |
| onChange | ((value: string | number) => void) | - | Called when value changes |
| onValueChange | OnValueChange | - | Called when value changes with react-number-format
payload |
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| prefix | string | - | Prefix added before the input value |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| startValue | number | - | Value set to the input when increment/decrement buttons are clicked or up/down arrows pressed if the input is empty |
| step | number | - | Number by which value will be incremented/decremented with up/down controls and keyboard arrows |
| stepHoldDelay | number | - | Initial delay in milliseconds before stepping the value. |
| stepHoldInterval | number | ((stepCount: number) => number) | - | Delay before stepping the value. Can be a number of milliseconds or a function that receives the current step count and returns the delay in milliseconds. |
| suffix | string | - | Suffix added after the input value |
| thousandSeparator | string | boolean | - | A character used to separate thousands |
| thousandsGroupStyle | "none" | "thousand" | "lakh" | "wan" | - | Defines the thousand grouping style. |
| trimLeadingZeroesOnBlur | boolean | - | If set, leading zeros are removed on blur. For example, 00100
-> 100
|
| type | "text" | "tel" | "password" | - | Controls input type
attribute |
| value | string | number | - | Controlled component value |
| valueIsNumericString | boolean | - | If value is passed as string representation of numbers (unformatted) and number is used in any format props like in prefix or suffix in numeric format and format prop in pattern format then this should be passed as true
. |
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| withKeyboardEvents | boolean | - | If set, up/down keyboard events increment/decrement value |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
NumberInput component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**NumberInput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-NumberInput-wrapper | Root element of the Input |
| input | .mantine-NumberInput-input | Input element |
| section | .mantine-NumberInput-section | Left and right sections |
| root | .mantine-NumberInput-root | Root element |
| label | .mantine-NumberInput-label | Label element |
| required | .mantine-NumberInput-required | Required asterisk element, rendered inside label |
| description | .mantine-NumberInput-description | Description element |
| error | .mantine-NumberInput-error | Error element |
| controls | .mantine-NumberInput-controls | Increment and decrement buttons wrapper |
| control | .mantine-NumberInput-control | Increment and decrement buttons |
**NumberInput CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| controls | --ni-chevron-size | Controls `width` and `height` of the default chevron icon |
**NumberInput data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| control | data-direction | - | - |
--------------------------------------------------------------------------------
### Overlay
Package: @mantine/core
Import: import { Overlay } from '@mantine/core';
Description: Overlays parent element with div element with any color and opacity
## Usage
`Overlay` takes 100% of width and height of parent container or viewport if `fixed` prop is set.
Set `color` and `backgroundOpacity` props to change `Overlay` background-color. Note that `backgroundOpacity` prop
does not change CSS opacity property, it changes background-color. For example, if you set
`color="#000"` and `backgroundOpacity={0.85}` background-color will be `rgba(0, 0, 0, 0.85)`:
#### Example: usage
```tsx
import { useState } from 'react';
import { Button, Overlay, AspectRatio } from '@mantine/core';
function Demo() {
const [visible, setVisible] = useState(true);
return (
<>



background-color
opacity 0β1, ignored when gradient
prop is set |
| blur | string | number | - | Overlay background blur |
| center | boolean | - | Centers content inside the overlay |
| children | React.ReactNode | - | Content inside overlay |
| color | BackgroundColor | - | Overlay background-color
|
| fixed | boolean | - | Changes position to fixed
|
| gradient | string | - | Changes overlay to gradient. If set, color
prop is ignored. |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius |
| zIndex | string | number | - | Overlay z-index |
#### Styles API
Overlay component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Overlay selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Overlay-root | Root element |
**Overlay CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --overlay-bg | Controls `background-color` |
| root | --overlay-filter | Controls `backdrop-filter` |
| root | --overlay-radius | Controls `border-radius` |
| root | --overlay-z-index | Controls `z-index` |
**Overlay data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-center | - | - |
| root | data-fixed | - | - |
--------------------------------------------------------------------------------
### CorePackage
Package: @mantine/core
Import: import { CorePackage } from '@mantine/core';
# Mantine Core components
[](https://www.npmjs.com/package/@mantine/core)
[@mantine/core](https://www.npmjs.com/package/@mantine/core) package
provides essential components: buttons, inputs, modals, typography and many others.
`@mantine/core` package is used internally in most of other `@mantine/*` packages β
it is required to be installed in your project to use Mantine components.
## Installation
```bash
yarn add @mantine/hooks @mantine/core
```
```bash
npm install @mantine/hooks @mantine/core
```
After installation import package styles at the root of your application:
```tsx
import '@mantine/core/styles.css';
```
## Usage
Follow the [getting started guide](https://mantine.dev/getting-started) to learn how to
complete Mantine setup in your project. Example of using [Stepper](https://mantine.dev/core/stepper) component:
#### Example: usage
```tsx
import { useState } from 'react';
import { Stepper, Button, Group } from '@mantine/core';
function Demo() {
const [active, setActive] = useState(1);
const nextStep = () => setActive((current) => (current < 3 ? current + 1 : current));
const prevStep = () => setActive((current) => (current > 0 ? current - 1 : current));
return (
<>
filled
variant |
| boundaries | number | - | Number of elements visible on the left/right edges |
| color | MantineColor | - | Key of theme.colors
, active item color |
| defaultValue | number | - | Active page for uncontrolled component, must be an integer in [0, total] interval |
| disabled | boolean | - | Disables all controls, applies disabled styles |
| dotsIcon | PaginationIcon | - | Dots icon component |
| firstIcon | PaginationIcon | - | First control icon component |
| gap | MantineSpacing | - | Key of theme.spacing
, gap between controls |
| getControlProps | ((control: "next" | "previous" | "first" | "last") => Recordtotal={1}
) |
| lastIcon | PaginationIcon | - | Last control icon component |
| nextIcon | PaginationIcon | - | Next control icon component |
| onChange | ((value: number) => void) | - | Called when page changes |
| onFirstPage | (() => void) | - | Called when first page control is clicked |
| onLastPage | (() => void) | - | Called when last page control is clicked |
| onNextPage | (() => void) | - | Called when next page control is clicked |
| onPreviousPage | (() => void) | - | Called when previous page control is clicked |
| previousIcon | PaginationIcon | - | Previous control icon component |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| siblings | number | - | Number of siblings displayed on the left/right side of the selected page |
| size | number | MantineSize | (string & {}) | - | height
and min-width
of controls |
| total | number | required | Total number of pages, must be an integer |
| value | number | - | Active page for controlled component, must be an integer in [0, total] interval |
| withControls | boolean | - | If set, next/previous controls are displayed |
| withEdges | boolean | - | If set, first/last controls are displayed |
| withPages | boolean | - | If set to false
, pages controls are hidden |
#### Styles API
Pagination component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Pagination selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Pagination-root | Root element |
| control | .mantine-Pagination-control | Control element: items, next/previous, first/last buttons |
| dots | .mantine-Pagination-dots | Dots icon wrapper |
**Pagination CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --pagination-active-bg | Active control `background-color` |
| root | --pagination-active-color | Active control `color` |
| root | --pagination-control-fz | Controls control `font-size` |
| root | --pagination-control-radius | Controls control `border-radius` |
| root | --pagination-control-size | Controls control `min-width` and `height` |
**Pagination data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| control | data-active | Control is active | - |
| control | data-disabled | Control is disabled | - |
--------------------------------------------------------------------------------
### Paper
Package: @mantine/core
Import: import { Paper } from '@mantine/core';
Description: Renders white or dark background depending on color scheme
## Usage
#### Example: usage
```tsx
import { Text, Paper } from '@mantine/core';
function Demo() {
return (
theme.radius
or any valid CSS value to set border-radius, numbers are converted to rem |
| shadow | MantineShadow | - | Key of theme.shadows
or any valid CSS value to set box-shadow
|
| withBorder | boolean | - | Adds border to the root element |
#### Styles API
Paper component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Paper selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Paper-root | Root element |
**Paper CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --paper-radius | Controls `border-radius` |
| root | --paper-shadow | Controls `box-shadow` |
**Paper data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-with-border | - | - |
--------------------------------------------------------------------------------
### PasswordInput
Package: @mantine/core
Import: import { PasswordInput } from '@mantine/core';
Description: Capture password data from user
## Usage
Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| inputContainer | ((children: ReactNode) => ReactNode) | - | Input container component |
| inputSize | string | - | size
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| onVisibilityChange | ((visible: boolean) => void) | - | Called when visibility changes |
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| visibilityToggleButtonProps | Recordrequired
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
PasswordInput component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**PasswordInput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-PasswordInput-wrapper | Root element of the Input |
| input | .mantine-PasswordInput-input | Input element |
| section | .mantine-PasswordInput-section | Left and right sections |
| root | .mantine-PasswordInput-root | Root element |
| label | .mantine-PasswordInput-label | Label element |
| required | .mantine-PasswordInput-required | Required asterisk element, rendered inside label |
| description | .mantine-PasswordInput-description | Description element |
| error | .mantine-PasswordInput-error | Error element |
| innerInput | .mantine-PasswordInput-innerInput | Actual input element |
| visibilityToggle | .mantine-PasswordInput-visibilityToggle | Visibility toggle button |
**PasswordInput CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --psi-button-size | Controls visibility toggle button `width` and `height` |
| root | --psi-icon-size | Controls visibility toggle icon `width` and `height` |
--------------------------------------------------------------------------------
### Pill
Package: @mantine/core
Import: import { Pill } from '@mantine/core';
Description: Removable and non-removable tags
## Usage
#### Example: usage
```tsx
import { Pill } from '@mantine/core';
function Demo() {
return theme.radius
or any valid CSS value to set border-radius. Numbers are converted to rem. |
| removeButtonProps | (CloseButtonProps & Omitfont-size
and padding
|
| withRemoveButton | boolean | - | Controls visibility of the remove button |
#### Styles API
Pill component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Pill selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Pill-root | Root element |
| label | .mantine-Pill-label | Pill label (children) |
| remove | .mantine-Pill-remove | Remove button |
**Pill CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --pill-height | Controls `height` of the pill |
| root | --pill-fz | Controls `font-size` |
| root | --pill-radius | Controls `border-radius` |
**Pill data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-with-remove | - | - |
| root | data-disabled | - | - |
**Pill.Group selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| group | .mantine-PillGroup-group | Root element |
**Pill.Group CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| group | --pg-gap | Controls `gap` between pills |
**Pillsinput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-Pillsinput-wrapper | Root element of the Input |
| input | .mantine-Pillsinput-input | Input element |
| section | .mantine-Pillsinput-section | Left and right sections |
| root | .mantine-Pillsinput-root | Root element |
| label | .mantine-Pillsinput-label | Label element |
| required | .mantine-Pillsinput-required | Required asterisk element, rendered inside label |
| description | .mantine-Pillsinput-description | Description element |
| error | .mantine-Pillsinput-error | Error element |
**Pillsinputfield selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| field | .mantine-Pillsinputfield-field | Root element |
**Pillsinputfield data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| field | data-type | - | Value of |
| field | data-disabled | - | - |
--------------------------------------------------------------------------------
### PillsInput
Package: @mantine/core
Import: import { PillsInput } from '@mantine/core';
Description: Base component for custom tags inputs and multi selects
## Usage
`PillsInput` is a utility component that can be used to create custom tag inputs, multi selects and
other similar components. By itself it does not include any logic, it only renders given children.
Usually, `PillsInput` is used in combination with [Pill](https://mantine.dev/core/pill) component.
#### Example: usage
```tsx
import { PillsInput, Pill } from '@mantine/core';
function Demo() {
return (
Input.Description
component. If not set, description is not displayed. |
| descriptionProps | (InputDescriptionProps & DataAttributes) | - | Props passed down to the Input.Description
component |
| disabled | boolean | - | Sets disabled
attribute on the input
element |
| error | React.ReactNode | - | Contents of Input.Error
component. If not set, error is not displayed. |
| errorProps | (InputErrorProps & DataAttributes) | - | Props passed down to the Input.Error
component |
| inputContainer | ((children: ReactNode) => ReactNode) | - | Input container component |
| inputSize | string | - | size
attribute passed down to the input element |
| inputWrapperOrder | ("input" | "label" | "description" | "error")[] | - | Controls order of the elements |
| label | React.ReactNode | - | Contents of Input.Label
component. If not set, label is not displayed. |
| labelProps | (InputLabelProps & DataAttributes) | - | Props passed down to the Input.Label
component |
| leftSection | React.ReactNode | - | Content section displayed on the left side of the input |
| leftSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the leftSection
element |
| leftSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the leftSection
element |
| leftSectionWidth | React.CSSProperties["width"] | - | Left section width, used to set width
of the section and input padding-left
, by default equals to the input height |
| pointer | boolean | - | Determines whether the input should have cursor: pointer
style |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| required | boolean | - | Adds required attribute to the input and a red asterisk on the right side of label |
| rightSection | React.ReactNode | - | Content section displayed on the right side of the input |
| rightSectionPointerEvents | React.CSSProperties["pointerEvents"] | - | Sets pointer-events
styles on the rightSection
element |
| rightSectionProps | React.ComponentPropsWithoutRef<"div"> | - | Props passed down to the rightSection
element |
| rightSectionWidth | React.CSSProperties["width"] | - | Right section width, used to set width
of the section and input padding-right
, by default equals to the input height |
| size | MantineSize | (string & {}) | - | Controls input height
and horizontal padding
|
| withAsterisk | boolean | - | If set, the required asterisk is displayed next to the label. Overrides required
prop. Does not add required attribute to the input. |
| withErrorStyles | boolean | - | Determines whether the input should have red border and red text color when the error
prop is set |
| wrapperProps | WrapperProps | - | Props passed down to the root element |
#### Styles API
PillsInput component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**PillsInput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| wrapper | .mantine-PillsInput-wrapper | Root element of the Input |
| input | .mantine-PillsInput-input | Input element |
| section | .mantine-PillsInput-section | Left and right sections |
| root | .mantine-PillsInput-root | Root element |
| label | .mantine-PillsInput-label | Label element |
| required | .mantine-PillsInput-required | Required asterisk element, rendered inside label |
| description | .mantine-PillsInput-description | Description element |
| error | .mantine-PillsInput-error | Error element |
**PillsInputfield selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| field | .mantine-PillsInputfield-field | Root element |
**PillsInputfield data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| field | data-type | - | Value of |
| field | data-disabled | - | - |
--------------------------------------------------------------------------------
### PinInput
Package: @mantine/core
Import: import { PinInput } from '@mantine/core';
Description: Capture pin code or one time password from the user
## Usage
#### Example: configurator
```tsx
import { PinInput } from '@mantine/core';
function Demo() {
return aria-label
attribute |
| autoFocus | boolean | - | If set, the first input is focused when component is mounted |
| defaultValue | string | - | Uncontrolled component default value |
| disabled | boolean | - | Adds disabled attribute to all inputs |
| error | boolean | - | Sets aria-invalid
attribute and applies error styles to all inputs |
| form | string | - | Hidden input form
attribute |
| gap | MantineSpacing | - | Key of theme.spacing
or any valid CSS value to set gap
between inputs, numbers are converted to rem |
| getInputProps | ((index: number) => InputProps & ElementProps<"input", "size">) | - | Props added to the input element depending on its index |
| hiddenInputProps | React.ComponentPropsWithoutRef<"input"> | - | Props passed down to the hidden input |
| id | string | - | Base id used to generate unique ids for inputs |
| inputMode | "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | - | inputmode
attribute, inferred from the type
prop if not specified |
| inputType | HTMLInputTypeAttribute | - | Inputs type
attribute, inferred from the type
prop if not specified |
| length | number | - | Number of inputs |
| manageFocus | boolean | - | Determines whether focus should be moved automatically to the next input once filled |
| mask | boolean | - | Changes input type to "password"
|
| name | string | - | Hidden input name
attribute |
| onChange | ((value: string) => void) | - | Called when value changes |
| onComplete | ((value: string) => void) | - | Called when all inputs have value |
| oneTimeCode | boolean | - | Determines whether autocomplete="one-time-code"
attribute should be set on all inputs |
| placeholder | string | - | Inputs placeholder |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| readOnly | boolean | - | If set, the user cannot edit the value |
| rootRef | ForwardedRefwidth
and height
|
| type | "number" | RegExp | "alphanumeric" | - | Determines which values can be entered |
| value | string | - | Controlled component value |
#### Styles API
PinInput component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**PinInput selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-PinInput-root | Root element |
| pinInput | .mantine-PinInput-pinInput | Input item wrapper |
| input | .mantine-PinInput-input | Input element |
**PinInput CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --pin-input-size | Controls input `width` and `height` |
--------------------------------------------------------------------------------
### Popover
Package: @mantine/core
Import: import { Popover } from '@mantine/core';
Description: Display popover section relative to given target element
## Usage
#### Example: usage
```tsx
import { Popover, Text, Button } from '@mantine/core';
function Demo() {
return (
border-radius
in px |
| arrowSize | number | - | Arrow size in px |
| children | React.ReactNode | - | Popover.Target
and Popover.Dropdown
components |
| clickOutsideEvents | string[] | - | Events that trigger outside clicks |
| closeOnClickOutside | boolean | - | Determines whether dropdown should be closed on outside clicks |
| closeOnEscape | boolean | - | Determines whether dropdown should be closed when Escape
key is pressed |
| defaultOpened | boolean | - | Initial opened state for uncontrolled component |
| disabled | boolean | - | If set, popover dropdown will not be rendered |
| floatingStrategy | FloatingStrategy | - | Changes floating ui [position strategy](https://floating-ui.com/docs/usefloating#strategy) |
| hideDetached | boolean | - | If set, the dropdown is hidden when the element is hidden with styles or not visible on the screen |
| id | string | - | Id base to create accessibility connections |
| keepMounted | boolean | - | If set, the dropdown is not unmounted from the DOM when hidden. display: none
styles are added instead. |
| middlewares | PopoverMiddlewares | - | Floating ui middlewares to configure position handling |
| offset | number | FloatingAxesOffsets | - | Offset of the dropdown element |
| onChange | ((opened: boolean) => void) | - | Called with current state when dropdown opens or closes |
| onClose | (() => void) | - | Called when dropdown closes |
| onDismiss | (() => void) | - | Called when the popover is dismissed by clicking outside or by pressing escape |
| onEnterTransitionEnd | (() => void) | - | Called when enter transition ends |
| onExitTransitionEnd | (() => void) | - | Called when exit transition ends |
| onOpen | (() => void) | - | Called when dropdown opens |
| onPositionChange | ((position: FloatingPosition) => void) | - | Called when dropdown position changes |
| opened | boolean | - | Controlled dropdown opened state |
| overlayProps | (OverlayProps & ElementProps<"div">) | - | Props passed down to Overlay
component |
| portalProps | BasePortalProps | - | Props to pass down to the Portal
when withinPortal
is true |
| position | FloatingPosition | - | Dropdown position relative to the target element |
| positionDependencies | any[] | - | @deprecated : Do not use, will be removed in 9.0 |
| preventPositionChangeWhenVisible | boolean | - | Prevents popover from flipping/shifting when it the dropdown is visible |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius |
| returnFocus | boolean | - | Determines whether focus should be automatically returned to control when dropdown closes |
| shadow | MantineShadow | - | Key of theme.shadows
or any other valid CSS box-shadow
value |
| transitionProps | TransitionProps | - | Props passed down to the Transition
component. Use to configure duration and animation type. |
| trapFocus | boolean | - | Determines whether focus should be trapped within dropdown |
| width | PopoverWidth | - | Dropdown width, or 'target'
to make dropdown width the same as target element |
| withArrow | boolean | - | Determines whether component should have an arrow |
| withOverlay | boolean | - | Determines whether the overlay should be displayed when the dropdown is opened |
| withRoles | boolean | - | Determines whether dropdown and target elements should have accessible roles |
| withinPortal | boolean | - | Determines whether dropdown should be rendered within the Portal
|
| zIndex | string | number | - | Dropdown z-index
|
#### Styles API
Popover component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Popover selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| dropdown | .mantine-Popover-dropdown | Dropdown element |
| arrow | .mantine-Popover-arrow | Dropdown arrow |
| overlay | .mantine-Popover-overlay | Overlay element |
**Popover CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| dropdown | --popover-radius | Controls dropdown border-radius |
| dropdown | --popover-shadow | Controls dropdown box-shadow |
**Popover data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| dropdown | data-position | - | Value of floating ui dropdown position |
--------------------------------------------------------------------------------
### Portal
Package: @mantine/core
Import: import { Portal } from '@mantine/core';
Description: Renders component outside of parent element tree
## Usage
Portal is a wrapper component for [ReactDOM.createPortal](https://reactjs.org/docs/portals.html) API.
Render any component or element at the end of `document.body` or at a given element. [Modal](https://mantine.dev/core/modal/) and [Drawer](https://mantine.dev/core/drawer/) components are wrapped in Portal by default.
Use Portal to render a component or an element at a different place (defaults to the end of `document.body`).
Portal is useful when you want to prevent parent styles from interfering with children,
usually all these styles are related to `position` and `z-index` properties
and portals are used for components with fixed position, for example, modals.
```tsx
import { useState } from 'react';
import { Portal } from '@mantine/core';
function Demo() {
const [opened, setOpened] = useState(false);
return (
First
Second
Third
document.body
|
--------------------------------------------------------------------------------
### Progress
Package: @mantine/core
Import: import { Progress } from '@mantine/core';
Description: Give user feedback for status of the task
## Usage
#### Example: usage
```tsx
import { Progress } from '@mantine/core';
function Demo() {
return ;
}
```
## Compound components
#### Example: compound
```tsx
import { Progress } from '@mantine/core';
function Demo() {
return (
striped
prop is ignored |
| autoContrast | boolean | - | If set, adjusts text color based on background color for filled
variant |
| color | MantineColor | - | Key of theme.colors
or any valid CSS value |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
|
| size | number | MantineSize | (string & {}) | - | Controls track height |
| striped | boolean | - | If set, the section has stripes |
| transitionDuration | number | - | Controls sections width transition duration, value is specified in ms |
| value | number | required | Value of the progress |
#### Styles API
Progress component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Progress selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Progress-root | Root element |
| section | .mantine-Progress-section | `Progress.Section` root element |
| label | .mantine-Progress-label | `Progress.Label` root element |
**Progress CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --progress-radius | Controls `border-radius` of track and sections |
| root | --progress-size | Controls height of progress bar |
| root | --progress-transition-duration | Controls width `transition-duration` of progress bar |
**Progress data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| section | data-striped | - | - |
| section | data-animated | - | - |
--------------------------------------------------------------------------------
### Radio
Package: @mantine/core
Import: import { Radio } from '@mantine/core';
Description: Wrapper for input type radio
## Usage
#### Example: configurator
```tsx
import { Radio } from '@mantine/core';
function Demo() {
return (
filled
variant |
| color | MantineColor | - | Key of theme.colors
or any valid CSS color to set input color in checked state |
| description | React.ReactNode | - | Description displayed below the label |
| error | React.ReactNode | - | Error displayed below the label |
| icon | FCtheme.colors
or any valid CSS color to set icon color, by default value depends on theme.autoContrast
|
| label | React.ReactNode | - | Content of the label
associated with the radio |
| labelPosition | "left" | "right" | - | Position of the label relative to the input |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius,
|
| rootRef | ForwardedReftheme.colors
or any valid CSS color, controls color of track and thumb |
| defaultValue | RangeSliderValue | - | Uncontrolled component default value |
| disabled | boolean | - | Disables slider |
| domain | [number, number] | - | Domain of the slider, defines the full range of possible values |
| hiddenInputProps | React.ComponentPropsWithoutRef<"input"> | - | Props passed down to the hidden input |
| inverted | boolean | - | Determines whether track values representation should be inverted |
| label | ReactNode | ((value: number) => ReactNode) | - | Function to generate label or any react node to render instead, set to null to disable label |
| labelAlwaysOn | boolean | - | Determines whether the label should be visible when the slider is not being dragged or hovered |
| labelTransitionProps | TransitionProps | - | Props passed down to the Transition
component |
| marks | { value: number; label?: ReactNode; }[] | - | Marks displayed on the track |
| max | number | - | Maximum possible value |
| maxRange | number | - | Maximum range interval |
| min | number | - | Minimal possible value |
| minRange | number | - | Minimal range interval |
| name | string | - | Hidden input name, use with uncontrolled component |
| onChange | ((value: RangeSliderValue) => void) | - | Called when value changes |
| onChangeEnd | ((value: RangeSliderValue) => void) | - | Called when user stops dragging slider or changes value with arrows |
| precision | number | - | Number of significant digits after the decimal point |
| pushOnOverlap | boolean | - | Determines whether the other thumb should be pushed by the current thumb dragging when minRange
/maxRange
is reached |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| restrictToMarks | boolean | - | Determines whether the selection should be only allowed from the given marks array |
| scale | ((value: number) => number) | - | A transformation function to change the scale of the slider |
| showLabelOnHover | boolean | - | Determines whether the label should be displayed when the slider is hovered |
| size | number | MantineSize | (string & {}) | - | Controls size of the track |
| step | number | - | Number by which value will be incremented/decremented with thumb drag and arrows |
| thumbChildren | React.ReactNode | - | Content rendered inside thumb |
| thumbFromLabel | string | - | First thumb aria-label
|
| thumbProps | ((index: 0 | 1) => Omitwidth
and height
, by default value is computed based on size
prop |
| thumbToLabel | string | - | Second thumb aria-label
|
| value | RangeSliderValue | - | Controlled component value |
--------------------------------------------------------------------------------
### Rating
Package: @mantine/core
Import: import { Rating } from '@mantine/core';
Description: Pick and display rating
## Usage
#### Example: configurator
```tsx
import { Rating } from '@mantine/core';
function Demo() {
return theme.colors
or any CSS color value |
| count | number | - | Number of controls |
| defaultValue | number | - | Uncontrolled component default value |
| emptySymbol | ReactNode | ((value: number) => ReactNode) | - | Icon displayed when the symbol is empty |
| fractions | number | - | Number of fractions each item can be divided into |
| fullSymbol | ReactNode | ((value: number) => ReactNode) | - | Icon displayed when the symbol is full |
| getSymbolLabel | ((index: number) => string) | - | A function to assign aria-label
of the the control at index given in the argument. If not specified, control index is used as aria-label
. |
| highlightSelectedOnly | boolean | - | If set, only the selected symbol changes to full symbol when selected |
| name | string | - | name
attribute passed down to all inputs. By default, name
is generated randomly. |
| onChange | ((value: number) => void) | - | Called when value changes |
| onHover | ((value: number) => void) | - | Called when one of the controls is hovered |
| readOnly | boolean | - | If set, the user cannot interact with the component |
| size | number | MantineSize | (string & {}) | - | Controls component size |
| value | number | - | Controlled component value |
#### Styles API
Rating component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**Rating selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-Rating-root | Root element |
| starSymbol | .mantine-Rating-starSymbol | Default star icon |
| input | .mantine-Rating-input | Item input, hidden by default |
| label | .mantine-Rating-label | Item label, used to display star icon |
| symbolBody | .mantine-Rating-symbolBody | Wrapper around star icon for centering |
| symbolGroup | .mantine-Rating-symbolGroup | Group of symbols, used to display fractions |
**Rating CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --rating-color | Controls filled star icon color |
| root | --rating-size | Controls star icon width and height |
**Rating data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| label | data-read-only | - | - |
| input | data-active | Input value is the same as component value | - |
| starSymbol | data-filled | Associated input value is less or equal to the component value | - |
--------------------------------------------------------------------------------
### RingProgress
Package: @mantine/core
Import: import { RingProgress } from '@mantine/core';
Description: Give user feedback for status of the task with circle diagram
## Usage
Set `sections` prop to an array of:
* `value` β number between 0 and 100 β amount of space filled by segment
* `color` β segment color from theme or any other css color value
#### Example: usage
```tsx
import { RingProgress, Text } from '@mantine/core';
function Demo() {
return (
{`{ x: ${scrollPosition.x}, y: ${scrollPosition.y} }`}
{lorem}
); return ( <>x
and y
coordinates) when viewport is scrolled |
| onTopReached | (() => void) | - | Called when scrollarea is scrolled all the way to the top |
| overscrollBehavior | OverscrollBehavior | - | Defines overscroll-behavior
of the viewport |
| scrollHideDelay | number | - | Scroll hide delay in ms, applicable only when type is set to hover
or scroll
|
| scrollbarSize | string | number | - | Scrollbar size, any valid CSS value for width/height, numbers are converted to rem, default value is 0.75rem |
| scrollbars | false | "x" | "y" | "xy" | - | Axis at which scrollbars must be rendered |
| type | "auto" | "scroll" | "always" | "hover" | "never" | - | Defines scrollbars behavior, hover
by default
- hover
β scrollbars are visible when mouse is over the scroll area
- scroll
β scrollbars are visible when the scroll area is scrolled
- always
β scrollbars are always visible
- never
β scrollbars are always hidden
- auto
β similar to overflow: auto
β scrollbars are always visible when the content is overflowing |
| viewportProps | DetailedHTMLPropsfilled
variant |
| color | MantineColor | - | Key of theme.colors
or any valid CSS color, changes color of indicator, by default color is based on current color scheme |
| data | (string | SegmentedControlItem)[] | required | Data based on which controls are rendered |
| defaultValue | string | - | Uncontrolled component default value |
| disabled | boolean | - | Determines whether the component is disabled |
| fullWidth | boolean | - | Determines whether the component should take 100% width of its parent |
| name | string | - | Name of the radio group, by default random name is generated |
| onChange | ((value: string) => void) | - | Called when value changes |
| orientation | "horizontal" | "vertical" | - | Component orientation |
| radius | MantineRadius | number | - | Key of theme.radius
or any valid CSS value to set border-radius
, numbers are converted to rem |
| readOnly | boolean | - | If set to false
, prevents changing the value |
| size | MantineSize | (string & {}) | - | Controls font-size
, padding
and height
properties |
| transitionDuration | number | - | Indicator transition-duration
in ms, set 0
to turn off transitions |
| transitionTimingFunction | string | - | Indicator transition-timing-function
property |
| value | string | - | Controlled component value |
| withItemsBorders | boolean | - | Determines whether there should be borders between items |
#### Styles API
SegmentedControl component supports Styles API. With Styles API, you can customize styles of any inner element. Follow the documentation to learn how to use CSS modules, CSS variables and inline styles to get full control over component styles.
**SegmentedControl selectors**
| Selector | Static selector | Description |
|----------|----------------|-------------|
| root | .mantine-SegmentedControl-root | Root element |
| control | .mantine-SegmentedControl-control | Wrapper element for input and label |
| input | .mantine-SegmentedControl-input | Input element (`input[type="radio"]`), hidden by default |
| label | .mantine-SegmentedControl-label | Label element associated with input |
| indicator | .mantine-SegmentedControl-indicator | Floating indicator that moves between items |
| innerLabel | .mantine-SegmentedControl-innerLabel | Wrapper of label element children |
**SegmentedControl CSS variables**
| Selector | Variable | Description |
|----------|----------|-------------|
| root | --sc-color | Control `background-color` of `indicator` |
| root | --sc-font-size | Controls `font-size` of labels |
| root | --sc-padding | Controls `padding` of control |
| root | --sc-radius | Controls `border-radius` of `indicator` and `root` elements |
| root | --sc-shadow | Controls `box-shadow` of indicator |
**SegmentedControl data attributes**
| Selector | Attribute | Condition | Value |
|----------|-----------|-----------|-------|
| root | data-full-width | - | - |
| root | data-with-items-border | - | - |
| root | data-disabled | Value of | - |
| control | data-orientation | - | Value of |
--------------------------------------------------------------------------------
### Select
Package: @mantine/core
Import: import { Select } from '@mantine/core';
Description: Custom searchable select