List
List
Styled ordered and unordered lists
Installation
npx @ravikumarsurya/mdx-ui add listUsage
Unordered Lists
Use hyphens, asterisks, or plus signs:
- Item one
- Item two
- Item threeOrdered Lists
Use numbers followed by periods:
1. First item
2. Second item
3. Third itemFeatures
- Clean, readable styling
- Proper spacing between items
- Nested list support
- Theme-aware colors
- Responsive design
Examples
- Install the CLI with
npx @ravikumarsurya/mdx-ui init - Add components with
npx @ravikumarsurya/mdx-ui add accordion - Import and use in your MDX files
- Clone the repository
- Install dependencies with
pnpm install - Start the dev server with
pnpm dev
Basic Unordered List
Features:
- Easy to use
- Fully customizable
- TypeScript support
- Dark mode readyBasic Ordered List
Installation steps:
1. Install the CLI
2. Initialize your project
3. Add components
4. Start buildingNested Lists
Project structure:
- src/
- components/
- mdx-ui/
- callout.tsx
- headings.tsx
- app/
- page.tsx
- public/
- package.jsonMixed Lists
Setup process:
1. Prerequisites
- Node.js installed
- Next.js project
- Tailwind CSS configured
2. Installation
- Run init command
- Add components
3. Configuration
- Update MDX settings
- Add component mappingsTask Lists
- [x] Install dependencies
- [x] Set up project
- [ ] Write documentation
- [ ] Deploy to productionStyling
Lists have:
- Consistent spacing between items
- Proper indentation for nested items
- Distinct markers (bullets or numbers)
- Readable line height
- Theme-aware text colors
Customization
Customize through component mappings:
import { Ul, Ol, Li } from "@/components/mdx-ui/list";
export const mdxComponents = {
ul: Ul,
ol: Ol,
li: Li,
};Variants
Compact Lists
For tighter spacing:
- Item 1
- Item 2
- Item 3Spaced Lists
For better readability with longer items:
- This is a longer list item that contains more detailed information about a specific topic
- This is another longer item with multiple sentences. It provides context and explanation.
- The third item continues the pattern with detailed contentAccessibility
- Uses semantic HTML (
<ul>,<ol>,<li>) - Proper ARIA roles are inherited
- Screen reader friendly
- Keyboard navigable
Best Practices
- Use unordered lists for items without sequence
- Use ordered lists for step-by-step instructions
- Keep list items concise
- Maintain consistent formatting
- Use nested lists sparingly for clarity
Notes
- Lists automatically get proper spacing
- Nested lists are indented appropriately
- Task lists require GitHub-flavored markdown