|
| 1 | +# TabGrid Component |
| 2 | + |
| 3 | +A tabbed interface for displaying grid items organized by category. |
| 4 | + |
| 5 | +## What is this? |
| 6 | + |
| 7 | +The TabGrid component displays a collection of items in a clean, organized layout with tabs. Each tab represents a category of items (like "EVM" or "Solana"), and clicking on a tab shows the relevant items as clickable cards. |
| 8 | + |
| 9 | +This component is useful when you have multiple items and want to group them by topic or category, making it easier for users to find what they need. |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +```tsx |
| 14 | +import { TabGrid } from "@components/TabGrid/TabGrid" |
| 15 | +;<TabGrid |
| 16 | + header="Tutorials" |
| 17 | + tabs={[ |
| 18 | + { |
| 19 | + name: "Getting Started", |
| 20 | + links: [ |
| 21 | + { |
| 22 | + title: "Quick Start Guide", |
| 23 | + description: "Learn the basics in 5 minutes", |
| 24 | + link: "/docs/quickstart", |
| 25 | + }, |
| 26 | + { |
| 27 | + title: "Installation", |
| 28 | + description: "Set up your development environment", |
| 29 | + link: "/docs/installation", |
| 30 | + }, |
| 31 | + ], |
| 32 | + }, |
| 33 | + { |
| 34 | + name: "Advanced", |
| 35 | + links: [ |
| 36 | + { |
| 37 | + title: "Architecture Overview", |
| 38 | + description: "Understand the system design", |
| 39 | + link: "/docs/architecture", |
| 40 | + }, |
| 41 | + ], |
| 42 | + }, |
| 43 | + ]} |
| 44 | +/> |
| 45 | +``` |
| 46 | + |
| 47 | +## How to set it up |
| 48 | + |
| 49 | +The component requires a `tabs` prop, which is an array of tab objects. Each tab object contains: |
| 50 | + |
| 51 | +- A **name** (the label shown on the tab button) |
| 52 | +- A list of **links** (the items shown when that tab is active) |
| 53 | + |
| 54 | +Each grid item needs three pieces of information: |
| 55 | + |
| 56 | +- **title** - The name of the item |
| 57 | +- **description** - A short sentence explaining what the item covers |
| 58 | +- **link** - The URL where the item can be found |
| 59 | + |
| 60 | +## Props Reference |
| 61 | + |
| 62 | +### `TabGrid` |
| 63 | + |
| 64 | +| Prop | Type | Required | Description | |
| 65 | +| --------- | -------- | -------- | ------------------------------------------------- | |
| 66 | +| `header` | `string` | Yes | The heading text displayed above the tabs | |
| 67 | +| `tabs` | `Tab[]` | Yes | List of tabs, each containing a category of items | |
| 68 | +| `columns` | `number` | No | Number of columns in the grid (defaults to 2) | |
| 69 | + |
| 70 | +### `Tab` |
| 71 | + |
| 72 | +| Property | Type | Required | Description | |
| 73 | +| -------- | ------------ | -------- | -------------------------------------------------------- | |
| 74 | +| `name` | `string` | Yes | The label displayed on the tab (e.g., "Getting Started") | |
| 75 | +| `links` | `GridItem[]` | Yes | The list of items to show when this tab is selected | |
| 76 | + |
| 77 | +### `GridItem` |
| 78 | + |
| 79 | +| Property | Type | Required | Description | |
| 80 | +| ------------- | -------- | -------- | -------------------------------------------- | |
| 81 | +| `title` | `string` | Yes | The item's heading | |
| 82 | +| `description` | `string` | Yes | A brief explanation of what users will learn | |
| 83 | +| `link` | `string` | Yes | The URL path to the item page | |
| 84 | + |
| 85 | +## Components |
| 86 | + |
| 87 | +- **TabGrid** - Main container with tabs and header |
| 88 | +- **ItemGrid** - Grid layout for item cards |
| 89 | +- **GridCard** - Individual item card with hover effects |
0 commit comments