Mantine

repository·master·Indexed 12 days ago

https://github.com/mantinedev/mantine

A modular React component library ecosystem providing UI components, hooks, and specialized utilities. Version 9.5.1 includes core components (@mantine/core), state management hooks (@mantine/hooks), form management (@mantine/form), and specialized packages for charts, notifications, modals, carousels, and a Model Context Protocol (MCP) server.

Tokens
483.3K
Snippets
1.9K
Records
3K
Agent score
98%

What's inside Mantine

  1. Overview of Mantine packages

    master

    Mantine is a comprehensive ecosystem of React libraries for building modern user interfaces. It is organized into several specialized packages that cover everything from core UI components to specialized utilities like form management, charts, and rich text editing.

    Core Packages

    • @mantine/core: The foundation of the library, containing over 100 UI components.
    • @mantine/hooks: A collection of 80+ hooks designed for state and UI management.
    • @mantine/form: A dedicated library for managing form state and validation.

    Specialized UI Packages

    • @mantine/charts: A charting library built on top of Recharts.
    • @mantine/notifications: A fully featured system for displaying application notifications.
    • @mantine/spotlight: Provides a Ctrl + K command center interface for applications.
    • @mantine/code-highlight: A code highlighting component powered by highlight.js.
    • @mantine/tiptap: A rich text editor based on Tiptap.
    • @mantine/dropzone: Handles file drag-and-drop functionality.
    • @mantine/carousel: A component for creating carousels.
    • @mantine/nprogress: A component for displaying navigation progress bars.
    • @mantine/modals: A centralized manager for handling application modals.
    • @mantine/schedule: A component for displaying scheduled events.
  2. Use TagsInput for multiple value entry

    master

    TagsInput allows users to enter multiple values, either by typing custom values or selecting from a list of suggestions. It is similar to MultiSelect, but specifically designed to allow custom input that is not present in the provided data array.

    import { TagsInput } from '@mantine/core';
    
    function Demo() {
      return <TagsInput data={['React', 'Angular', 'Vue']} />;
    }
  3. Recommendation for new projects: Use Vite or Next.js instead of CRA

    master

    Create React App (CRA) was deprecated in early 2023. Starting from Mantine version 7.0, some styling features are not officially supported in CRA.

    For new projects, it is highly recommended to use Vite or Next.js instead of CRA.

    • For Single Page Applications (SPA), use Vite.
    • Mantine provides official templates for Vite: Vite + Mantine template.
  4. Use WeekView for weekly event scheduling

    master

    The WeekView component displays events for an entire week with time slots. It supports all-day events, overlapping events, drag and drop, custom time ranges, and more. It uses CSS container queries for responsive layouts, automatically adjusting padding and labels based on the container width.

    import { WeekView } from '@mantine/schedule';
    
    // Basic usage
    <WeekView data={events} />
  5. What is a polymorphic component?

    master

    A polymorphic component is a component that allows you to change its underlying root HTML element or React component using the component prop. Every polymorphic component has a default element used when the component prop is omitted.

    For example, the Button component defaults to a button element, but can be transformed into an anchor (a) tag to support link-like behavior.

    import { Button } from '@mantine/core';
    
    function Demo() {
      return (
        <Button component="a" href="https://mantine.dev/" target="_blank">
          Mantine website
        </Button>
      );
    }