# Mantine UI Library - Complete Documentation This file contains comprehensive documentation for the Mantine UI library including: - Complete component documentation with all usage examples - Full demo code for every example shown in the documentation - Complete props tables with types and descriptions for all components - Styles API documentation showing all available selectors - FAQ and troubleshooting guides All code examples use production npm package imports (e.g., @mantine/core, @mantine/hooks) ================================================================================ ## CORE COMPONENTS AND FEATURES Primary Package: @mantine/core ### Accordion Package: @mantine/core Import: import { Accordion } from '@mantine/core'; Description: Divide content into collapsible sections ## Usage Accordion allows users to expand and collapse sections of content. It helps manage large amounts of information in a limited space by showing only the section headers initially and revealing content on interaction. Accordion is commonly used for: * FAQ sections: displaying questions as headers with answers revealed on click * Forms: organizing long forms into sections, for example, personal info, shipping, and payment * Menus: nested navigation in sidebars or mobile views #### Example: configurator ```tsx // Demo.tsx import { Accordion } from '@mantine/core'; import { data } from './data'; function Demo() { const items = data.map((item) => ( {item.value} {item.description} )); return ( {items} ); } // data.ts export const data = [ { emoji: '🍎', value: 'Apples', description: 'Crisp and refreshing fruit. Apples are known for their versatility and nutritional benefits. They come in a variety of flavors and are great for snacking, baking, or adding to salads.', }, { emoji: '🍌', value: 'Bananas', description: 'Naturally sweet and potassium-rich fruit. Bananas are a popular choice for their energy-boosting properties and can be enjoyed as a quick snack, added to smoothies, or used in baking.', }, { emoji: 'πŸ₯¦', value: 'Broccoli', description: 'Nutrient-packed green vegetable. Broccoli is packed with vitamins, minerals, and fiber. It has a distinct flavor and can be enjoyed steamed, roasted, or added to stir-fries.', }, ]; ``` ## Change chevron Use the `chevron` prop to change the chevron icon. When `chevron` is set, `chevronIconSize` prop is ignored. To remove the chevron icon, use `chevron={null}`. To customize chevron styles, use [Styles API](https://mantine.dev/styles/styles-api/) with [data-rotate](https://mantine.dev/styles/data-attributes/) attribute. It is set when the item is opened if the `disableChevronRotation` prop is not set. Example of a custom chevron icon with rotation styles: #### Example: chevron ```tsx // Demo.module.css .chevron { &[data-rotate] { transform: rotate(45deg); } } .icon { width: 16px; height: 16px; } // data.ts export const data = [ { emoji: '🍎', value: 'Apples', description: 'Crisp and refreshing fruit. Apples are known for their versatility and nutritional benefits. They come in a variety of flavors and are great for snacking, baking, or adding to salads.', }, { emoji: '🍌', value: 'Bananas', description: 'Naturally sweet and potassium-rich fruit. Bananas are a popular choice for their energy-boosting properties and can be enjoyed as a quick snack, added to smoothies, or used in baking.', }, { emoji: 'πŸ₯¦', value: 'Broccoli', description: 'Nutrient-packed green vegetable. Broccoli is packed with vitamins, minerals, and fiber. It has a distinct flavor and can be enjoyed steamed, roasted, or added to stir-fries.', }, ]; ``` ## Custom control label You can use any React node as a label for `Accordion.Control` component. When you use nested elements in `Accordion.Control`, it is recommended to set `aria-label` attribute to make the control accessible for screen readers. #### Example: label ```tsx import { Group, Avatar, Text, Accordion } from '@mantine/core'; const charactersList = [ { id: 'bender', image: 'https://img.icons8.com/clouds/256/000000/futurama-bender.png', label: 'Bender Bending RodrΓ­guez', description: 'Fascinated with cooking, though has no sense of taste', content: "Bender Bending RodrΓ­guez, (born September 4, 2996), designated Bending Unit 22, and commonly known as Bender, is a bending unit created by a division of MomCorp in Tijuana, Mexico, and his serial number is 2716057. His mugshot id number is 01473. He is Fry's best friend.", }, { id: 'carol', image: 'https://img.icons8.com/clouds/256/000000/futurama-mom.png', label: 'Carol Miller', description: 'One of the richest people on Earth', content: "Carol Miller (born January 30, 2880), better known as Mom, is the evil chief executive officer and shareholder of 99.7% of Momcorp, one of the largest industrial conglomerates in the universe and the source of most of Earth's robots. She is also one of the main antagonists of the Futurama series.", }, { id: 'homer', image: 'https://img.icons8.com/clouds/256/000000/homer-simpson.png', label: 'Homer Simpson', description: 'Overweight, lazy, and often ignorant', content: 'Homer Jay Simpson (born May 12) is the main protagonist and one of the five main characters of The Simpsons series(or show). He is the spouse of Marge Simpson and father of Bart, Lisa and Maggie Simpson.', }, ]; interface AccordionLabelProps { label: string; image: string; description: string; } function AccordionLabel({ label, image, description }: AccordionLabelProps) { return (
{label} {description}
); } function Demo() { const items = charactersList.map((item) => ( {item.content} )); return ( {items} ); } ``` ## With icons Use `icon` prop to display any element on the left section of the `Accordion.Control`: #### Example: icons ```tsx import { IconPhoto, IconPrinter, IconCameraSelfie } from '@tabler/icons-react'; import { Accordion } from '@mantine/core'; function Demo() { return ( } > Recent photos Content } > Print photos Content } > Camera settings Content ); } ``` ## Change transition To change transition duration, set `transitionDuration` prop: To disable transitions, set `transitionDuration` to 0: ## Default opened items For `multiple={false}`, set `defaultValue` as string: ```tsx import { Accordion } from '@mantine/core'; function Demo() { // Second item will be opened by default return ( {/* item-1 */} {/* item-2 */} ); } ``` For `multiple={true}`, set `defaultValue` as an array of strings: ```tsx import { Accordion } from '@mantine/core'; function Demo() { // Both items are opened by default return ( {/* item-1 */} {/* item-2 */} ); } ``` ## Control opened state For `multiple={false}`, set `value` as string: ```tsx import { useState } from 'react'; import { Accordion } from '@mantine/core'; function Demo() { const [value, setValue] = useState(null); return ( {/* item-1 */} {/* item-2 */} ); } ``` For `multiple={true}`, set `value` as an array of strings: ```tsx import { useState } from 'react'; import { Accordion } from '@mantine/core'; function Demo() { const [value, setValue] = useState([]); return ( {/* item-2 */} {/* item-2 */} ); } ``` ## Compose controls Putting a button or a link inside `Accordion.Control` is a common mistake when using Accordion. `Accordion.Control` root element is `button`. Putting interactive elements inside other interactive elements is forbidden – you will receive a DOM validation error from React if you try to implement the following component: ```tsx import { Accordion } from '@mantine/core'; // ❌ Incorrect usage: do not do this function Demo() { return ( Control 1 Panel 1 ); } ``` Instead of putting interactive elements inside the `Accordion.Control`, render them next to it. For example, you can add [ActionIcon](https://mantine.dev/core/action-icon/) or [Menu](https://mantine.dev/core/menu/) on the right side of the original control. If you need to display an interactive element over the `Accordion.Control`, use `position: absolute` instead. #### Example: sideControls ```tsx import { Accordion, ActionIcon, AccordionControlProps, Center } from '@mantine/core'; import { IconDots } from '@tabler/icons-react'; function AccordionControl(props: AccordionControlProps) { return (
); } function Demo() { return ( Control 1 Panel 1 Control 2 Panel 2 Control 3 Panel 3 ); } ``` ## Disabled items Set the `disabled` prop on the `Accordion.Control` component to disable it. When you disable items, users cannot activate them with mouse or keyboard, and arrow key navigation will skip them: #### Example: disabled ```tsx // Demo.tsx import { Accordion } from '@mantine/core'; import { data } from './data'; function Demo() { const items = data.map((item) => ( {item.value} {item.description} )); return ( {items} ); } // data.ts export const data = [ { emoji: '🍎', value: 'Apples', description: 'Crisp and refreshing fruit. Apples are known for their versatility and nutritional benefits. They come in a variety of flavors and are great for snacking, baking, or adding to salads.', }, { emoji: '🍌', value: 'Bananas', description: 'Naturally sweet and potassium-rich fruit. Bananas are a popular choice for their energy-boosting properties and can be enjoyed as a quick snack, added to smoothies, or used in baking.', }, { emoji: 'πŸ₯¦', value: 'Broccoli', description: 'Nutrient-packed green vegetable. Broccoli is packed with vitamins, minerals, and fiber. It has a distinct flavor and can be enjoyed steamed, roasted, or added to stir-fries.', }, ]; ``` ## Unstyled Accordion Set the `unstyled` prop on the Accordion component to remove all non-essential library styles. Use `unstyled` prop to style the component with [Styles API](https://mantine.dev/styles/styles-api/) without overriding any styles. #### Example: unstyled ```tsx import { Accordion } from '@mantine/core'; function Demo() { return ( {/* ... Accordion items */} ); } ``` #### Example: stylesApi ```tsx import { Accordion } from '@mantine/core'; import { data } from './data'; function Demo() { const items = data.map((item) => ( {item.value} {item.description} )); return ( {items} ); } ``` Example of using [Styles API](https://mantine.dev/styles/styles-api/) to customize Accordion styles: #### Example: customize ```tsx // Demo.module.css .root { border-radius: var(--mantine-radius-sm); background-color: light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-6)); } .item { background-color: light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-6)); border: 1px solid transparent; position: relative; z-index: 0; transition: transform 150ms ease; &[data-active] { transform: scale(1.03); z-index: 1; background-color: var(--mantine-color-body); border-color: light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-4)); box-shadow: var(--mantine-shadow-md); border-radius: var(--mantine-radius-md); } } .chevron { &[data-rotate] { transform: rotate(-90deg); } } // data.ts export const data = [ { emoji: '🍎', value: 'Apples', description: 'Crisp and refreshing fruit. Apples are known for their versatility and nutritional benefits. They come in a variety of flavors and are great for snacking, baking, or adding to salads.', }, { emoji: '🍌', value: 'Bananas', description: 'Naturally sweet and potassium-rich fruit. Bananas are a popular choice for their energy-boosting properties and can be enjoyed as a quick snack, added to smoothies, or used in baking.', }, { emoji: 'πŸ₯¦', value: 'Broccoli', description: 'Nutrient-packed green vegetable. Broccoli is packed with vitamins, minerals, and fiber. It has a distinct flavor and can be enjoyed steamed, roasted, or added to stir-fries.', }, ]; ``` ## TypeScript `AccordionProps` type exported from `@mantine/core` is a generic, it accepts boolean type that describes `multiple` state: ```tsx import type { AccordionProps } from '@mantine/core'; type MultipleAccordionProps = AccordionProps; type DefaultAccordionProps = AccordionProps; ``` ## Accessibility Accordion component implement [WAI-ARIA accessibility recommendations](https://www.w3.org/TR/wai-aria-practices-1.1/examples/accordion/accordion.html). Set `order` on `Accordion` component to wrap accordion controls with `h2`-`h6` headings. The following example wraps controls with `h3` tags: ```tsx import { Accordion } from '@mantine/core'; function Demo() { return {/* ...items */}; } ``` Keyboard interactions: #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | chevron | React.ReactNode | - | Custom chevron icon | | chevronIconSize | string | number | - | Size of the default chevron icon. Ignored when chevron prop is set. | | chevronPosition | AccordionChevronPosition | - | Position of the chevron relative to the item label | | chevronSize | string | number | - | Size of the chevron icon container | | defaultValue | string | string[] | null | - | Uncontrolled component default value | | disableChevronRotation | boolean | - | If set, chevron rotation is disabled | | loop | boolean | - | If set, arrow keys loop though items (first to last and last to first) | | multiple | boolean | - | If set, multiple items can be opened at the same time | | onChange | ((value: AccordionValue) => void) | - | Called when value changes, payload type depends on multiple prop | | order | 2 | 3 | 4 | 5 | 6 | - | Heading order, has no effect on visuals | | radius | MantineRadius | number | - | Key of theme.radius or any valid CSS value to set border-radius. Numbers are converted to rem. | | transitionDuration | number | - | Transition duration in ms | | value | string | string[] | null | - | Controlled component value | #### Styles API Accordion 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. **Accordion selectors** | Selector | Static selector | Description | |----------|----------------|-------------| | root | .mantine-Accordion-root | Root element | | item | .mantine-Accordion-item | `Accordion.Item` root element | | control | .mantine-Accordion-control | `Accordion.Control` root element | | chevron | .mantine-Accordion-chevron | `Accordion.Control` chevron container element | | label | .mantine-Accordion-label | `Accordion.Control` label | | icon | .mantine-Accordion-icon | `Accordion.Control` icon | | itemTitle | .mantine-Accordion-itemTitle | `Accordion.Control` title (h2-h6) tag | | panel | .mantine-Accordion-panel | `Accordion.Panel` root element | | content | .mantine-Accordion-content | Wrapper element of `Accordion.Panel` `children` | **Accordion CSS variables** | Selector | Variable | Description | |----------|----------|-------------| | root | --accordion-chevron-size | Controls chevron container element `width` and `min-width` | | root | --accordion-radius | Controls `border-radius` in various elements, depending on variant | | root | --accordion-transition-duration | Controls all animations `transition-duration` | -------------------------------------------------------------------------------- ### ActionIcon Package: @mantine/core Import: import { ActionIcon } from '@mantine/core'; Description: Icon button ## Usage #### Example: usage ```tsx import { ActionIcon } from '@mantine/core'; import { IconAdjustments } from '@tabler/icons-react'; function Demo() { return ( ); } ``` ## Gradient ActionIcon supports Mantine color format in color prop. Color can be specified as: - Mantine color name (e.g., 'blue') - CSS color value (e.g., '#fff', 'rgba(255, 255, 255, 0.8)') - Gradient string (e.g., 'linear-gradient(45deg, blue, red)') #### Example: gradient ```tsx import { ActionIcon } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; function Demo() { return ( ); } ``` ## Size You can use any valid CSS value in `size` prop, it is used to set `width`, `min-width`, `min-height` and `height` properties. Note that `size` prop does not control child [icon](https://mantine.dev/guides/icons) size, you need to set it manually on icon component. When `size` is a number, the value is treated as `px` units and converted to [rem](https://mantine.dev/styles/rem) units. #### Example: size ```tsx import { ActionIcon } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; function Demo() { return ( ); } ``` If you want `ActionIcon` to have the same size as Mantine inputs, use `size="input-sm"` prop: #### Example: inputSize ```tsx import { ActionIcon, Group, TextInput } from '@mantine/core'; function Demo() { return ( SM ); } ``` ## Disabled state To make `ActionIcon` disabled set `disabled` prop, this will prevent any interactions with the button and add disabled styles. If you want the button to just look disabled but still be interactive, set `data-disabled` prop instead. Note that disabled styles are the same for all variants. #### Example: disabled ```tsx import { ActionIcon, Group } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; function Demo() { return ( ); } ``` ## Disabled state when ActionIcon is link `` element does not support `disabled` attribute. To make `ActionIcon` disabled when it is rendered as a link, set `data-disabled` attribute instead and prevent default behavior in `onClick` event handler. #### Example: disabledLink ```tsx import { ActionIcon } from '@mantine/core'; import { IconExternalLink } from '@tabler/icons-react'; function Demo() { return ( event.preventDefault()} > ); } ``` ## Customize disabled styles To customize disabled styles, it is recommended to use both `&:disabled` and `&[data-disabled]` selectors: * `&:disabled` is used to style the button when `disabled` prop is set and also when the button is disabled by the parent component (for example, when `disabled` prop is set on a `
` element which contains `ActionIcon`). * `&[data-disabled]` is used to style the button when it is not actually disabled but should look like it is (for example, `data-disabled` should be used if you need to use [Tooltip](https://mantine.dev/core/tooltip) with disabled `ActionIcon` or when `ActionIcon` is used as a link) #### Example: disabledStyles ```tsx // Demo.module.css .button { &:disabled, &[data-disabled] { border-color: light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4)); background-color: transparent; } } // Demo.tsx import { ActionIcon } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; import classes from './Demo.module.css'; function Demo() { return ( ); } ``` ## Disabled button with Tooltip `onMouseLeave` event [is not triggered](https://github.com/facebook/react/issues/18753) when `ActionIcon` is disabled, so if you need to use [Tooltip](https://mantine.dev/core/tooltip) with disabled `ActionIcon` you need to set `data-disabled` prop on `ActionIcon` instead of `disabled`. Note that it is also required to change `onClick` event handler to `(event) => event.preventDefault()` as `ActionIcon` is not actually disabled and will still trigger `onClick` event. #### Example: disabledTooltip ```tsx import { ActionIcon, Tooltip } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; function Demo() { return ( event.preventDefault()}> ); } ``` ## Loading state When `loading` prop is set, `ActionIcon` will be disabled and [Loader](https://mantine.dev/core/loader) with overlay will be rendered in the center of the button. [Loader](https://mantine.dev/core/loader) color depends on `ActionIcon` variant. #### Example: loading ```tsx import { ActionIcon, Group, Switch } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; import { IconHeart } from '@tabler/icons-react'; function Demo() { const [loading, { toggle }] = useDisclosure(); return ( <> ); } ``` ## Loader props You can customize [Loader](https://mantine.dev/core/loader) with `loaderProps` prop, it accepts all props that [Loader](https://mantine.dev/core/loader) component has: #### Example: loaderProps ```tsx import { ActionIcon } from '@mantine/core'; function Demo() { return ; } ``` ## Add custom variants To add new `ActionIcon` variants, use [data-variant](https://mantine.dev/styles/variants-sizes) attribute. Usually new variants are added on [theme](https://mantine.dev/theming/theme-object), this way they are available in all `ActionIcon` components in your application. #### Example: customVariant ```tsx // Demo.tsx import { Group, ActionIcon, MantineProvider, createTheme } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; import classes from './Demo.module.css'; const theme = createTheme({ components: { ActionIcon: ActionIcon.extend({ classNames: classes, }), }, }); function Demo() { return ( ); } // Demo.module.css .root { &[data-variant='danger'] { background-color: var(--mantine-color-red-9); color: var(--mantine-color-red-0); } &[data-variant='primary'] { background: linear-gradient(45deg, #4b6cb7 10%, #253b67 90%); color: var(--mantine-color-white); } } ``` ## Customize variants colors You can customize colors for `ActionIcon` and other components variants by adding [variantColorResolver](https://mantine.dev/theming/colors#colors-variant-resolver) to your theme. #### Example: variantColorsResolver ```tsx import { IconPhoto, IconFingerprint, IconError404 } from '@tabler/icons-react'; import { ActionIcon, Group, MantineProvider, defaultVariantColorsResolver, VariantColorsResolver, parseThemeColor, rgba, darken, } from '@mantine/core'; const variantColorResolver: VariantColorsResolver = (input) => { const defaultResolvedColors = defaultVariantColorsResolver(input); const parsedColor = parseThemeColor({ color: input.color || input.theme.primaryColor, theme: input.theme, }); // Override some properties for variant if (parsedColor.isThemeColor && parsedColor.color === 'lime' && input.variant === 'filled') { return { ...defaultResolvedColors, color: 'var(--mantine-color-black)', hoverColor: 'var(--mantine-color-black)', }; } // Completely override variant if (input.variant === 'light') { return { background: rgba(parsedColor.value, 0.1), hover: rgba(parsedColor.value, 0.15), border: `1px solid ${parsedColor.value}`, color: darken(parsedColor.value, 0.1), }; } // Add new variants support if (input.variant === 'danger') { return { background: 'var(--mantine-color-red-9)', hover: 'var(--mantine-color-red-8)', color: 'var(--mantine-color-white)', border: 'none', }; } return defaultResolvedColors; }; function Demo() { return ( ); } ``` ## autoContrast ActionIcon supports autoContrast prop and [theme.autoContrast](https://mantine.dev/theming/theme-object/#autocontrast). If autoContrast is set either on ActionIcon or on theme, content color will be adjusted to have sufficient contrast with the value specified in color prop. Note that autoContrast feature works only if you use color prop to change background color. autoContrast works only with filled variant. #### Example: autoContrast ```tsx import { IconFingerprint } from '@tabler/icons-react'; import { ActionIcon, Group } from '@mantine/core'; function Demo() { return ( ); } ``` ## Add custom sizes `ActionIcon` sizes are defined by `--ai-size-{x}` CSS variables. The easiest way to add new sizes is to define additional `--ai-size-{x}` variables on the `root` element: #### Example: customSize ```tsx // Demo.tsx import { ActionIcon, createTheme, Group, MantineThemeProvider } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; import classes from './Demo.module.css'; const theme = createTheme({ components: { ActionIcon: ActionIcon.extend({ classNames: classes, }), }, }); function Demo() { return ( ); } // Demo.module.css .root { --ai-size-xxs: 16px; --ai-size-xxl: 50px; } ``` ## ActionIcon.Group #### Example: group ```tsx import { ActionIcon } from '@mantine/core'; import { IconPhoto, IconSettings, IconHeart } from '@tabler/icons-react'; function Demo() { return ( ); } ``` Note that you must not wrap child `ActionIcon` components with any additional elements: ```tsx import { ActionIcon } from '@mantine/core'; // Will not work correctly function Demo() { return (
This will not work
ActionIcons will have incorrect borders
); } ``` ## ActionIcon.GroupSection Use `ActionIcon.GroupSection` component to render sections that are not `ActionIcon` inside `ActionIcon.Group`: #### Example: groupSection ```tsx import { IconChevronDown, IconChevronUp } from '@tabler/icons-react'; import { ActionIcon } from '@mantine/core'; import { useCounter } from '@mantine/hooks'; function Demo() { const [value, { increment, decrement }] = useCounter(135, { min: 0 }); return ( {value} ); } ``` ## Polymorphic component ActionIcon is a polymorphic component – its default root element is button, but it can be changed to any other element or component with component prop: ```tsx import { ActionIcon } from '@mantine/core'; function Demo() { return ; } ``` You can also use components in component prop, for example, Next.js Link: ```tsx import Link from 'next/link'; import { ActionIcon } from '@mantine/core'; function Demo() { return ; } ``` **Polymorphic components with TypeScript** Note that polymorphic components props types are different from regular components – they do not extend HTML element props of the default element. For example, ActionIconProps does not extend React.ComponentPropsWithoutRef<'button'> although button is the default element. If you want to create a wrapper for a polymorphic component that is not polymorphic (does not support component prop), then your component props interface should extend HTML element props. ## Get element ref ```tsx import { useRef } from 'react'; import { ActionIcon } from '@mantine/core'; function Demo() { const ref = useRef(null); return ; } ``` ## Accessibility To make `ActionIcon` accessible for screen readers, you need to either set `aria-label` or use [VisuallyHidden](https://mantine.dev/core/visually-hidden) component: ```tsx import { IconHeart } from '@tabler/icons-react'; import { ActionIcon, VisuallyHidden } from '@mantine/core'; function Demo() { return ( <> Like post ); } ``` #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | autoContrast | boolean | - | If set, adjusts text color based on background color for filled variant | | children | React.ReactNode | - | Icon element | | color | MantineColor | - | Key of theme.colors or any valid CSS color. | | disabled | boolean | - | Sets disabled attribute, prevents interactions | | gradient | MantineGradient | - | Gradient values used with variant="gradient". | | loaderProps | LoaderProps | - | Props passed down to the Loader component. Ignored when loading prop is not set. | | loading | boolean | - | If set, Loader component is displayed instead of the children | | 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 & {}) | "input-xs" | "input-sm" | "input-md" | "input-lg" | "input-xl" | - | Controls width and height of the button. Numbers are converted to rem. | #### Styles API ActionIcon 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. **ActionIcon selectors** | Selector | Static selector | Description | |----------|----------------|-------------| | root | .mantine-ActionIcon-root | Root element | | loader | .mantine-ActionIcon-loader | `Loader` component, rendered inside root element when `loading` prop is set | | icon | .mantine-ActionIcon-icon | Inner icon wrapper | **ActionIcon CSS variables** | Selector | Variable | Description | |----------|----------|-------------| | root | --ai-bg | Controls `background` | | root | --ai-hover | Controls `background` when hovered | | root | --ai-bd | Controls `border` | | root | --ai-color | Controls icon `color` | | root | --ai-hover-color | Controls icon `color` when hovered | | root | --ai-radius | Controls `border-radius` | | root | --ai-size | Controls `width`, `height`, `min-width` and `min-height` styles | **ActionIcon data attributes** | Selector | Attribute | Condition | Value | |----------|-----------|-----------|-------| | root | data-disabled | - | - | **ActionIcon.Group selectors** | Selector | Static selector | Description | |----------|----------------|-------------| | group | .mantine-ActionIconGroup-group | Root element | **ActionIcon.Group CSS variables** | Selector | Variable | Description | |----------|----------|-------------| **ActionIcon.Group data attributes** | Selector | Attribute | Condition | Value | |----------|-----------|-----------|-------| | group | data-orientation | - | Value of | -------------------------------------------------------------------------------- ### Affix Package: @mantine/core Import: import { Affix } from '@mantine/core'; Description: Renders children inside portal at fixed position ## Usage `Affix` renders a div element with a fixed position inside the [Portal](https://mantine.dev/core/portal) component. Use it to display elements fixed at any position on the screen, for example, scroll to top button: #### Example: usage ```tsx import { IconArrowUp } from '@tabler/icons-react'; import { useWindowScroll } from '@mantine/hooks'; import { Affix, Button, Text, Transition } from '@mantine/core'; function Demo() { const [scroll, scrollTo] = useWindowScroll(); return ( <> Affix is located at the bottom of the screen, scroll to see it 0}> {(transitionStyles) => ( )} ); } ``` #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | portalProps | BasePortalProps | - | Props passed down to the Portal component. Ignored when withinPortal is false. | | position | AffixPosition | - | Affix position on screen | | withinPortal | boolean | - | Determines whether the component is rendered within Portal | | zIndex | React.CSSProperties["zIndex"] | - | Root element z-index property | #### Styles API Affix 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. **Affix selectors** | Selector | Static selector | Description | |----------|----------------|-------------| | root | .mantine-Affix-root | Root element | **Affix CSS variables** | Selector | Variable | Description | |----------|----------|-------------| | root | --affix-z-index | Controls `z-index` property | | root | --affix-top | Controls `top` property | | root | --affix-bottom | Controls `bottom` property | | root | --affix-left | Controls `left` property | | root | --affix-right | Controls `right` property | -------------------------------------------------------------------------------- ### Alert Package: @mantine/core Import: import { Alert } from '@mantine/core'; Description: Attract user attention with important static message ## Usage #### Example: configurator ```tsx import { Alert } from '@mantine/core'; import { IconInfoCircle } from '@tabler/icons-react'; function Demo() { const icon = ; return ( {{children}} ); } ``` #### Example: stylesApi ```tsx import { Alert } from '@mantine/core'; import { IconHeart } from '@tabler/icons-react'; import classes from './Demo.module.css'; function Demo() { const icon = ; return ( Lorem ipsum dolor sit, amet consectetur adipisicing elit. Sunt corporis natus veniam quis cupiditate enim architecto mollitia numquam temporibus, consectetur nam laboriosam voluptates nemo facilis? Exercitationem aut praesentium quibusdam reiciendis. ); } ``` ## Accessibility * Root element role set to `alert` * `aria-describedby` set to body element id, `aria-labelledby` set to title element id if `title` is provided * Set `closeButtonLabel` prop to make close button accessible ```tsx import { Alert } from '@mantine/core'; function Invalid() { // -> not ok return ; } function Valid() { // -> ok return ; } function AlsoValid() { // -> ok, without close button, closeButtonLabel is not needed return ; } ``` #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | autoContrast | boolean | - | If set, adjusts text color based on background color for filled variant | | closeButtonLabel | string | - | Close button aria-label | | color | MantineColor | - | Key of theme.colors or any valid CSS color | | icon | React.ReactNode | - | Icon displayed next to the title | | 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 | - | Alert title | | withCloseButton | boolean | - | Determines whether close button should be displayed | #### Styles API Alert 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. **Alert selectors** | Selector | Static selector | Description | |----------|----------------|-------------| | root | .mantine-Alert-root | Root element | | wrapper | .mantine-Alert-wrapper | Wrapper around `body` and `icon` | | body | .mantine-Alert-body | Body element, contains `title` and `message` | | title | .mantine-Alert-title | Title element, contains `label` and `icon` | | label | .mantine-Alert-label | Title label | | message | .mantine-Alert-message | Alert message | | icon | .mantine-Alert-icon | Icon element | | closeButton | .mantine-Alert-closeButton | Close button | **Alert CSS variables** | Selector | Variable | Description | |----------|----------|-------------| | root | --alert-bd | Controls `border` | | root | --alert-bg | Controls `background` | | root | --alert-color | Controls `color` | | root | --alert-radius | Controls `border-radius` | **Alert data attributes** | Selector | Attribute | Condition | Value | |----------|-----------|-----------|-------| | title | data-with-close-button | - | - | -------------------------------------------------------------------------------- ### Anchor Package: @mantine/core Import: import { Anchor } from '@mantine/core'; Description: Display link with theme styles ## Usage #### Example: usage ```tsx import { Anchor } from '@mantine/core'; function Demo() { return ( Anchor component ); } ``` ## Underline Use `underline` prop to configure `text-decoration` property. It accepts the following values: * `always` - link is always underlined * `hover` - link is underlined on hover * `never` - link is never underlined * `not-hover` - link is underlined when not hovered #### Example: decoration ```tsx import { Anchor, Group } from '@mantine/core'; function Demo() { return ( Underline always Underline hover Underline never Underline not-hover ); } ``` You can also configure `underline` prop for all `Anchor` components with [default props](https://mantine.dev/theming/default-props): ```tsx import { Anchor, createTheme, MantineProvider } from '@mantine/core'; const theme = createTheme({ components: { Anchor: Anchor.extend({ defaultProps: { underline: 'always', }, }), }, }); function Demo() { return ( {/* Your app here */} ); } ``` ## Text props `Anchor` components supports all [Text](https://mantine.dev/core/text) component props. For example, you can use gradient variant: #### Example: textProps ```tsx import { Anchor } from '@mantine/core'; function Demo() { return ( A link with pink to yellow gradient ); } ``` ## Polymorphic component Anchor is a polymorphic component – its default root element is a, but it can be changed to any other element or component with component prop: ```tsx import { Anchor } from '@mantine/core'; function Demo() { return ; } ``` You can also use components in component prop, for example, Next.js Link: ```tsx import Link from 'next/link'; import { Anchor } from '@mantine/core'; function Demo() { return ; } ``` **Polymorphic components with TypeScript** Note that polymorphic components props types are different from regular components – they do not extend HTML element props of the default element. For example, AnchorProps does not extend React.ComponentPropsWithoutRef<'a'> although a is the default element. If you want to create a wrapper for a polymorphic component that is not polymorphic (does not support component prop), then your component props interface should extend HTML element props. ## Get element ref ```tsx import { useRef } from 'react'; import { Anchor } from '@mantine/core'; function Demo() { const ref = useRef(null); return ; } ``` #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | color | MantineColor | - | @deprecated Use c prop instead | | gradient | MantineGradient | - | Gradient configuration, ignored when variant is not gradient | | 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 | | truncate | TextTruncate | - | Side on which Text must be truncated, if true, text is truncated from the start | | underline | "always" | "hover" | "not-hover" | "never" | - | Defines when text-decoration: underline styles are applied. | -------------------------------------------------------------------------------- ### AngleSlider Package: @mantine/core Import: import { AngleSlider } from '@mantine/core'; Description: Pick angle value between 0 and 360 ## Usage Use `AngleSlider` component to pick angle value between 0 and 360: #### Example: usage ```tsx import { AngleSlider } from '@mantine/core'; function Demo() { return ; } ``` ## Controlled `AngleSlider` value is a number between 0 and 360. ```tsx import { useState } from 'react'; import { AngleSlider } from '@mantine/core'; function Demo() { const [value, setValue] = useState(180); return ; } ``` ## formatLabel Use the `formatLabel` prop to change the angle label format. It accepts a function that takes the angle value and returns a React node: #### Example: formatLabel ```tsx import { AngleSlider } from '@mantine/core'; function Demo() { return `${value}Β°`} />; } ``` ## Marks Set the `marks` prop to display marks on the slider. Mark is an object of value (required, number between 0 and 360) and label (optional, React node). To restrict selection to marks only, set the `restrictToMarks` prop: #### Example: marks ```tsx import { AngleSlider, Group } from '@mantine/core'; function Demo() { return ( `${value}Β°`} size={100} restrictToMarks marks={[ { value: 0 }, { value: 45 }, { value: 90 }, { value: 135 }, { value: 180 }, { value: 225 }, { value: 270 }, { value: 315 }, ]} /> `${value}Β°`} size={100} marks={[ { value: 0, label: '0Β°' }, { value: 45, label: '45Β°' }, { value: 90, label: '90Β°' }, { value: 135, label: '135Β°' }, { value: 180, label: '180Β°' }, { value: 225, label: '225Β°' }, { value: 270, label: '270Β°' }, { value: 315, label: '315Β°' }, ]} /> ); } ``` ## onChangeEnd The `onChangeEnd` callback fires when the user stops dragging the slider or changes its value with the keyboard. Use it as a debounced callback to prevent frequent updates. #### Example: onChangeEnd ```tsx import { useState } from 'react'; import { AngleSlider, Text } from '@mantine/core'; function Demo() { const [value, setValue] = useState(0); const [endValue, setEndValue] = useState(0); return ( <> Current value: {value} End value: {endValue} ); } ``` ## disabled `disabled` prop disables the component and prevents user interaction: #### Example: disabled ```tsx import { AngleSlider } from '@mantine/core'; function Demo() { return ; } ``` ## Accessibility To make the component accessible for screen readers, set the `aria-label` prop: ```tsx import { AngleSlider } from '@mantine/core'; function Demo() { return ; } ``` Keyboard interactions when the component is focused: ## Based on use-radial-move `AngleSlider` is based on the [use-radial-move](https://mantine.dev/hooks/use-radial-move) hook. You can build a custom radial slider using this hook if you need more control over the component's behavior. #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | defaultValue | number | - | Uncontrolled component default value | | disabled | boolean | - | Sets data-disabled attribute, disables interactions | | formatLabel | ((value: number) => ReactNode) | - | A function to format label based on the current value | | hiddenInputProps | React.ComponentPropsWithoutRef<"input"> | - | Props passed down to the hidden input | | marks | { value: number; label?: string; }[] | undefined | - | Array of marks displayed on the slider | | name | string | - | Hidden input name, use with uncontrolled component | | onChange | ((value: number) => void) | - | Called on value change | | onChangeEnd | ((value: number) => void) | - | Called after the selection is finished | | onScrubEnd | (() => void) | - | Called in onMouseUp and onTouchEnd | | onScrubStart | (() => void) | - | Called in onMouseDown and onTouchStart | | restrictToMarks | boolean | - | If set, the selection is allowed only from the given marks array | | size | number | - | Slider size in px | | step | number | - | Step between values | | thumbSize | number | - | Size of the thumb in px. Calculated based on the size value by default. | | value | number | - | Controlled component value | | withLabel | boolean | - | If set, the label is displayed inside the slider | #### Styles API AngleSlider 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. **AngleSlider selectors** | Selector | Static selector | Description | |----------|----------------|-------------| | root | .mantine-AngleSlider-root | Root element | | label | .mantine-AngleSlider-label | Label inside the slider | | marks | .mantine-AngleSlider-marks | Wrapper for all marks | | mark | .mantine-AngleSlider-mark | Mark element | | thumb | .mantine-AngleSlider-thumb | Slider thumb | **AngleSlider CSS variables** | Selector | Variable | Description | |----------|----------|-------------| | root | --slider-size | Controls slider width and height | | root | --thumb-size | Controls thumb size | **AngleSlider data attributes** | Selector | Attribute | Condition | Value | |----------|-----------|-----------|-------| | root | disabled | - | - | -------------------------------------------------------------------------------- ### AppShell Package: @mantine/core Import: import { AppShell } from '@mantine/core'; Description: Responsive shell for your application with header, navbar, aside and footer ## Examples This page includes only documentation. All associated `AppShell` components have a fixed position; examples are included in a separate documentation section. ## Usage `AppShell` is a layout component that can be used to implement a common Header / Navbar / Footer / Aside layout pattern. All `AppShell` components have `position: fixed` style, so they do not scroll with the page. [Basic AppShell example](https://mantine.dev/app-shell?e=BasicAppShell) with header and navbar. The navbar is hidden on mobile by default and toggled with the burger button. ```tsx import { AppShell, Burger } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; function Demo() { const [opened, { toggle }] = useDisclosure(); return (
Logo
Navbar Main
); } ``` ## AppShell components * `AppShell` – root component that wraps all other sections and configures the overall layout. * `AppShell.Header` – fixed header at the top, controlled by the `header` prop. * `AppShell.Navbar` – fixed navbar on the left, controlled by the `navbar` prop. * `AppShell.Aside` – fixed aside on the right, controlled by the `aside` prop. * `AppShell.Footer` – fixed footer at the bottom, controlled by the `footer` prop. * `AppShell.Main` – main content area, statically positioned and offset by the other sections. * `AppShell.Section` – utility for grouping content inside `AppShell.Navbar` or `AppShell.Aside`, useful for scrollable areas. ## Configuration The `AppShell` component accepts `header`, `footer`, `navbar`, and `aside` props to configure the corresponding sections. You must set these props if you want to use the associated components. For example, to use the `AppShell.Header` component, you need to set the `header` prop on the `AppShell` component. `header` and `footer` configuration objects share the same type: ```tsx interface Configuration { /** Height of the section: number, string or ** object with breakpoints as keys and height as values */ height: AppShellSize | AppShellResponsiveSize; /** When collapsed is true, the section is hidden ** from the viewport and doesn't affect AppShell.Main offset */ collapsed?: boolean; /** Controls whether AppShell.Main should be offset by this section. ** Useful for scenarios like hiding a header based on scroll position. */ offset?: boolean; } ``` `navbar` and `aside` configuration objects type: ```tsx interface Configuration { /** Width of the section: number, string, or ** object with breakpoints as keys and widths as values */ width: AppShellSize | AppShellResponsiveSize; /** Breakpoint at which section switches to mobile mode. ** In mobile mode, the section always has 100% width and its ** collapsed state is controlled by `collapsed.mobile` ** instead of `collapsed.desktop` */ breakpoint: MantineBreakpoint | (string & {}) | number; /** Determines whether the section should be collapsed */ collapsed?: { desktop?: boolean; mobile?: boolean }; } ``` ## layout prop `layout` prop controls how `AppShell.Header`/`AppShell.Footer` and `AppShell.Navbar`/`AppShell.Aside` are positioned relative to each other. It accepts `alt` and `default` values: * `alt` – `AppShell.Navbar`/`AppShell.Aside` extends the full viewport height, while `AppShell.Header`/`AppShell.Footer` width equals the viewport width minus the width of `AppShell.Navbar` and `AppShell.Aside` ([example](https://mantine.dev/app-shell?e=AltLayout)) * `default` – `AppShell.Navbar`/`AppShell.Aside` height equals the viewport height minus `AppShell.Header`/`AppShell.Footer` height, and `AppShell.Header`/`AppShell.Footer` spans the full viewport width ([example](https://mantine.dev/app-shell?e=FullLayout)) ## Height configuration `height` property in `header` and `footer` configuration objects works the following way: * If you pass a number, the value will be converted to [rem](https://mantine.dev/styles/rem) and used as height at all viewport sizes. * To change height based on viewport width, use an object with breakpoints as keys and height as values. This works the same way as [style props](https://mantine.dev/styles/style-props#responsive-styles). Example with height as a number: `height` is converted to [rem](https://mantine.dev/styles/rem), `height` is the same at all viewport sizes: ```tsx import { AppShell } from '@mantine/core'; function Demo() { return ( Header ); } ``` Example with height as an object with breakpoints: * `height` is 48 when viewport width is \< `theme.breakpoints.sm` * `height` is 60 when viewport width is >= `theme.breakpoints.sm` and \< `theme.breakpoints.lg` * `height` is 76 when viewport width is >= `theme.breakpoints.lg` ```tsx import { AppShell } from '@mantine/core'; function Demo() { return ( Header ); } ``` ## Width configuration `width` property in `navbar` and `aside` configuration objects works the following way: * If you pass a number, the value will be converted to [rem](https://mantine.dev/styles/rem) and used as width when the viewport is larger than `breakpoint`. * To change width based on viewport width, use an object with breakpoints as keys and width as values. This works the same way as [style props](https://mantine.dev/styles/style-props#responsive-styles). Note that width is always 100% when the viewport is smaller than `breakpoint`. Example with width as a number: `width` is converted to [rem](https://mantine.dev/styles/rem), `width` is the same at viewport sizes larger than `breakpoint`, `width` is 100% when viewport width is less than `breakpoint`: ```tsx import { AppShell } from '@mantine/core'; function Demo() { return ( Navbar ); } ``` Example with width as an object with breakpoints: * `width` is 100% when viewport width is \< `theme.breakpoints.sm` * `width` is 200 when viewport width is >= `theme.breakpoints.sm` and \< `theme.breakpoints.lg` * `width` is 300 when viewport width is >= `theme.breakpoints.lg` ```tsx import { AppShell } from '@mantine/core'; function Demo() { return ( Navbar ); } ``` ## padding prop The `padding` prop controls the padding of the `AppShell.Main` component. It's important to use this prop instead of setting padding directly on `AppShell.Main` because this padding is also used to offset the `AppShell.Header`, `AppShell.Navbar`, `AppShell.Aside`, and `AppShell.Footer` components. The `padding` prop works the same way as [style props](https://mantine.dev/styles/style-props#responsive-styles) and accepts numbers, strings, and objects with breakpoints as keys and padding values. You can reference `theme.spacing` values or use any valid CSS values. Example with static `padding` prop: ```tsx import { AppShell } from '@mantine/core'; function Demo() { return {/* AppShell content */}; } ``` Example with responsive `padding` prop: * `padding` is 10 when viewport width is \< `theme.breakpoints.sm` * `padding` is 15 when viewport width is >= `theme.breakpoints.sm` and \< `theme.breakpoints.lg` * `padding` is `theme.spacing.xl` when viewport width is >= `theme.breakpoints.lg` ```tsx import { AppShell } from '@mantine/core'; function Demo() { return ( {/* AppShell content */} ); } ``` ## Header offset configuration The `header` prop includes an `offset` property that allows you to control whether the `AppShell.Main` component is offset by the header's height. This is particularly useful when you want to collapse the `AppShell.Header` based on scroll position. For example, you can use the [use-headroom](https://mantine.dev/hooks/use-headroom) hook to hide the header when the user scrolls down and show it when scrolling up ([example](https://mantine.dev/app-shell?e=Headroom)). ```tsx import { AppShell, rem } from '@mantine/core'; import { useHeadroom } from '@mantine/hooks'; function Demo() { const pinned = useHeadroom({ fixedAt: 120 }); return ( Header {/* Content */} ); } ``` ## Collapsed navbar/aside configuration The `navbar` and `aside` props include a `collapsed` property that accepts an object with the format `{ mobile: boolean; desktop: boolean }`. This allows you to configure the collapsed state differently based on viewport width. [Example](https://mantine.dev/app-shell?e=CollapseDesktop) with separate collapsed states for mobile and desktop: ```tsx import { AppShell, Button } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; export function CollapseDesktop() { const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(); const [desktopOpened, { toggle: toggleDesktop }] = useDisclosure(true); return ( Header Navbar ); } ``` ## withBorder prop The `withBorder` prop is available on `AppShell` and associated sections: `AppShell.Header`, `AppShell.Navbar`, `AppShell.Aside` and `AppShell.Footer`. By default, `withBorder` prop is `true` – all components have a border on the side that is adjacent to the `AppShell.Main` component. For example, `AppShell.Header` is located at the top of the page – it has a border on the bottom side, `AppShell.Navbar` is located on the left side of the page – it has a border on the right side. To remove the border from all components, set `withBorder={false}` on the `AppShell`: ```tsx import { AppShell } from '@mantine/core'; // None of the components will have a border function Demo() { return ( {/* AppShell content */} ); } ``` To remove the border from a specific component, set `withBorder={false}` on that component: ```tsx import { AppShell } from '@mantine/core'; function Demo() { return ( Header ); } ``` ## zIndex prop The `zIndex` prop is available on `AppShell` and its associated sections: `AppShell.Header`, `AppShell.Navbar`, `AppShell.Aside`, and `AppShell.Footer`. By default, all sections have a `z-index` of `100`. To change the `z-index` of all sections, set the `zIndex` prop on the `AppShell` component: ```tsx import { AppShell } from '@mantine/core'; // All sections will have z-index of 200 function Demo() { return {/* AppShell content */}; } ``` To change `z-index` of a specific section, set `zIndex` prop on that section: ```tsx import { AppShell } from '@mantine/core'; // AppShell.Header has z-index of 100 // AppShell.Navbar and AppShell.Aside have z-index of 300 function Demo() { return ( Header Navbar Aside ); } ``` ## Control transitions Use the `transitionDuration` and `transitionTimingFunction` props on the `AppShell` component to control section animations: ```tsx import { AppShell } from '@mantine/core'; function Demo() { return ( {/* AppShell content */} ); } ``` ## disabled prop Set the `disabled` prop on the `AppShell` component to prevent all sections except `AppShell.Main` from rendering. This is useful when you want to hide the shell on certain pages of your application. ```tsx import { AppShell } from '@mantine/core'; function Demo() { return {/* AppShell content */}; } ``` ## AppShell.Section component `AppShell.Section` is used to create organized areas within `AppShell.Navbar` and `AppShell.Aside`. Since these components are flexbox containers with `flex-direction: column`, the `AppShell.Section` component with the `grow` prop will expand to fill available space and can be made scrollable by setting `component={ScrollArea}`. In the following example: * The first and last sections (header and footer) take only the space needed for their content * The middle section with `grow` takes all remaining space and becomes scrollable when content exceeds the available height ```tsx import { AppShell, ScrollArea } from '@mantine/core'; function Demo() { return ( Navbar header Navbar main section, it will Navbar footer – always at the bottom Main ); } ``` ## Semantic elements Important: do not use `
` inside `AppShell.Main`, it is allowed to use only one `
` element per page. ## CSS variables Example of using CSS variables in styles: ```scss .main { min-height: calc(100dvh - var(--app-shell-header-height)); } ``` #### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | aside | AppShellAsideConfiguration | - | 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 ( Panda ); } ``` ## Map embed #### Example: map ```tsx import { AspectRatio } from '@mantine/core'; function Demo() { return (