import { Meta, Source } from "@storybook/blocks";
# Migration Guide: From size="compact" to Default Compact Sizing
This guide helps you migrate from the previous `size="compact"` pattern to the new Mantine-idiomatic approach.
## Overview
The compact-mantine theme has been refactored to use Mantine's `defaultProps` system. This means:
- **Before**: Components required explicit `size="compact"` prop
- **After**: Components default to compact sizing (`size="sm"`) automatically
## Quick Migration Steps
### Step 1: Remove size="compact" Props
Find and remove all `size="compact"` props from your components:
-
-
// After (no size prop needed)
+
+
+
`}
/>
### Step 2: Update Size Overrides
If you previously used default Mantine sizing (without specifying size), you now need to explicitly set the size:
// After (explicitly specify md for larger size)
+
`}
/>
## Size Mapping Reference
| Previous Usage | New Usage |
|----------------|-----------|
| `size="compact"` | No size prop (compact by default) |
| No size prop (Mantine default) | `size="md"` |
| `size="xs"` | `size="xs"` (unchanged) |
| `size="sm"` | No size prop or `size="sm"` |
| `size="lg"` | `size="lg"` (unchanged) |
## Breaking Changes
### 1. size="compact" Is No Longer a Valid Size
The custom `size="compact"` value is no longer recognized. Components will render with a custom `data-size="compact"` attribute but without the expected compact styling.
**Action Required**: Remove all `size="compact"` props.
### 2. Default Size Changed from "md" to "sm"
All components now default to `size="sm"` instead of Mantine's default `size="md"`.
**Action Required**: If you want larger components, explicitly set `size="md"` or `size="lg"`.
### 3. Global Token Overrides
The theme now overrides Mantine's global tokens:
- **fontSizes**: xs=10px, sm=11px, md=13px, lg=14px, xl=16px
- **spacing**: xs=4px, sm=6px, md=8px, lg=12px, xl=16px
- **radius**: xs=2px, sm=4px, md=6px, lg=8px, xl=12px
## Code Examples
### Basic Usage
{/* These use compact sizing automatically */}
);
}
`}
/>
### Overriding to Larger Sizes
`}
/>
### Theme Customization
{/* Still compact by default, but with teal primary color */}
);
}
`}
/>
### Compact Region in Larger UI
{/* Regular Mantine UI */}
{/* Compact region */}
);
}
`}
/>
## Affected Components
The following 43 components are affected by this migration:
### Input Components (14)
TextInput, NumberInput, Select, Textarea, PasswordInput, Autocomplete, MultiSelect, TagsInput, PillsInput, FileInput, JsonInput, ColorInput, NativeSelect, InputWrapper
### Button Components (3)
Button, ActionIcon, CloseButton
### Control Components (6)
Switch, Checkbox, Radio, Slider, RangeSlider, SegmentedControl
### Display Components (7)
Badge, Text, Avatar, ThemeIcon, Indicator, Kbd, Pill
### Navigation Components (6)
Tabs, NavLink, Pagination, Stepper, Anchor, Burger
### Feedback Components (3)
Loader, Progress, RingProgress
### Overlay Components (4)
Menu, Tooltip, Popover, HoverCard
## Need Help?
- View the [Size Comparison stories](?path=/story/theme-size-comparison--default-compact-size) for visual examples
- Check individual component stories for specific usage patterns
- File issues at the project repository for bugs or questions