Language: JavaScript
UI Framework
Mantine was created by Vitaly Rtishchev in 2021 to deliver a React component library with a strong focus on accessibility, customization, and developer productivity. It combines a large set of ready-to-use components with useful hooks, making it a versatile toolkit for building modern applications.
Mantine is a modern React component library that provides over 100 fully featured components and hooks. It supports server-side rendering, dark theme, accessibility, and offers an extensive set of form and data display components.
npm install @mantine/core @mantine/hooksyarn add @mantine/core @mantine/hooksMantine does not provide an official CDN build; install via npm or yarn.Install Mantine packages from npm and import components as needed.Mantine provides components for inputs, navigation, overlays, typography, and data display. It also includes hooks for state management, responsiveness, and user interactions.
import { Button } from '@mantine/core';
function Demo() {
return <Button>Hello Mantine</Button>;
}Renders a simple button component with Mantine’s default styling.
import { TextInput } from '@mantine/core';
<TextInput label="Email" placeholder="your@email.com" />Creates a text input field with a label and placeholder.
import { useState } from 'react';
import { Modal, Button } from '@mantine/core';
function Demo() {
const [opened, setOpened] = useState(false);
return (
<>
<Modal opened={opened} onClose={() => setOpened(false)} title="Mantine Modal">
Modal content goes here
</Modal>
<Button onClick={() => setOpened(true)}>Open Modal</Button>
</>
);
}Demonstrates usage of Mantine’s Modal with state management.
import { Tabs } from '@mantine/core';
<Tabs defaultValue="first">
<Tabs.List>
<Tabs.Tab value="first">First tab</Tabs.Tab>
<Tabs.Tab value="second">Second tab</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="first">First panel</Tabs.Panel>
<Tabs.Panel value="second">Second panel</Tabs.Panel>
</Tabs>Creates an accessible tabbed interface using Mantine Tabs.
import { Grid } from '@mantine/core';
<Grid>
<Grid.Col span={6}>Column 1</Grid.Col>
<Grid.Col span={6}>Column 2</Grid.Col>
</Grid>Implements a responsive two-column layout using Mantine Grid.
Wrap your application in MantineProvider to configure themes and global styles.
Use Mantine hooks like `useDisclosure` and `useForm` to simplify state management.
Take advantage of Mantine’s color schemes and dark mode support for better UX.
Use Mantine’s Grid and Flex components for consistent layouts.
Prefer Mantine’s built-in accessibility features instead of manually handling ARIA roles.