Horizontal Ruler Component - Decorative Section Dividers

Oct 22, 2025
tutorial astromdxreactuidesign
3   Minutes
470   Words

Horizontal Ruler Component

Add elegant, animated section dividers to your Astro MDX blog posts. Perfect for separating sections or adding visual breaks.

🌸🌼🌺🌻🌷

📦 Import the Components

import HorizontalRuler from "@/react/HorizontalRuler/HorizontalRuler.jsx";

or with relative path:

import HorizontalRuler from "../../react/HorizontalRuler/HorizontalRuler.jsx";

Important: Use .mdx extension (not .md) when working with React components.

🚀 Basic Usage

Simply add the component anywhere in your MDX:

<HorizontalRuler />
🌸🌼🌺🌻🌷

That’s it! The ruler automatically adapts to your site’s theme (light/dark mode).


🎨 Variants

Choose from 6 beautiful styles:

Flowers (Default)

🌸🌼🌺🌻🌷
<HorizontalRuler variant="flowers" />

Delicate floral design with 🌸🌼🌺🌻🌷

🌸🌼🌺🌻🌷

Stars

💫🌟
<HorizontalRuler variant="stars" />

Celestial theme with 💫🌟

💫🌟

Hearts

💚💛💙💜
<HorizontalRuler variant="hearts" />

Colorful hearts with 💚💛💙💜

💚💛💙💜

Geometric

<HorizontalRuler variant="geometric" />

Clean geometric shapes with ◆◇

Dots

<HorizontalRuler variant="dots" />

Minimalist dot pattern

Minimal

<HorizontalRuler variant="minimal" />

Ultra-minimal dash style


📏 Sizes

Control the height and icon size:

Small

🌸🌼🌺🌻🌷
<HorizontalRuler size="small" />

Medium (Default)

🌸🌼🌺🌻🌷
<HorizontalRuler size="medium" />

Large

🌸🌼🌺🌻🌷
<HorizontalRuler size="large" />

📐 Spacing

Adjust the vertical spacing around the ruler:

Tight

🌸🌼🌺🌻🌷
<HorizontalRuler spacing="tight" />

Less vertical space (20px top/bottom)

Normal (Default)

🌸🌼🌺🌻🌷
<HorizontalRuler spacing="normal" />

Standard spacing (40px top/bottom)

Loose

🌸🌼🌺🌻🌷
<HorizontalRuler spacing="loose" />

More vertical space (60px top/bottom)


🎨 Custom Colors

Auto Color (Default)

Adapts to theme automatically:

🌸🌼🌺🌻🌷
<HorizontalRuler color="auto" />

Custom Colors

💚💛💙💜
<HorizontalRuler color="#ec4899" variant="hearts" />
💫🌟
<HorizontalRuler color="#3b82f6" variant="stars" />
<HorizontalRuler color="#8b5cf6" variant="geometric" />

⚙️ Props Reference

PropTypeDefaultOptionsDescription
variantstring”flowers”flowers, stars, dots, hearts, geometric, minimalVisual style
sizestring”medium”small, medium, largeHeight and icon size
spacingstring”normal”tight, normal, looseVertical spacing
colorstring”auto”auto, any hex colorIcon color

💡 Usage Examples

Blog Post Header

Use after the title to separate header from content:

---
title: "My Awesome Blog Post"
---
# My Awesome Blog Post
<HorizontalRuler variant="flowers" spacing="tight" />
Your blog content starts here...
🌸🌼🌺🌻🌷

Section Dividers

Separate major sections in long posts:

## Introduction
Content here...
<HorizontalRuler variant="stars" />
## Main Content
More content...
<HorizontalRuler variant="stars" />
## Conclusion
Final thoughts...

End of Post

Mark the end of your blog post:

Thanks for reading!
<HorizontalRuler variant="hearts" size="large" />
*Published on October 22, 2025*
💚💛💙💜

Combine with Other Components

Works great with other components:

<Tabs defaultValue="tab1" client:load>
<TabItem value="tab1" label="First">
Content...
</TabItem>
</Tabs>
<HorizontalRuler variant="geometric" spacing="loose" />
<Dropdown client:load>
<DropdownOption value="opt1" label="Option">
Content...
</DropdownOption>
</Dropdown>

🎯 Design Tips

1. Match Your Theme

Choose variants that complement your blog’s aesthetic:

  • Modern/Tech blogs: geometric or minimal
  • Creative/Art blogs: flowers or stars
  • Personal blogs: hearts or flowers
  • Professional blogs: dots or minimal

2. Consistent Usage

Pick 1-2 variants and use them consistently throughout your blog for a cohesive look.

3. Size Matters

  • Headers: Use size="small" with spacing="tight"
  • Section breaks: Use size="medium" with spacing="normal"
  • Dramatic breaks: Use size="large" with spacing="loose"

4. Color Coordination

Let the ruler use color="auto" to match your theme, or set custom colors to match your brand.


Features

  • Auto theme detection - Adapts to light/dark mode
  • Smooth animations - Gentle floating effect
  • Fully customizable - Variants, sizes, spacing, colors
  • Responsive - Works on all screen sizes
  • Zero dependencies - Pure React
  • Lightweight - Minimal performance impact
💫🌟

🎨 Creative Combinations

Mix different props for unique styles:

🌸🌼🌺🌻🌷
💫🌟
💚💛💙💜

📝 Quick Reference

Common Patterns

// After title
<HorizontalRuler variant="flowers" spacing="tight" />
// Between sections
<HorizontalRuler variant="stars" />
// End of post
<HorizontalRuler variant="hearts" size="large" />
// Minimal divider
<HorizontalRuler variant="minimal" size="small" />
// Custom themed
<HorizontalRuler variant="geometric" color="#3b82f6" />

🌸🌼🌺🌻🌷

🎉 Start Using Today!

Add beautiful, animated section dividers to your Astro MDX blog posts with just one line of code. Perfect for creating visual hierarchy and improving readability.

💚💛💙💜

Happy blogging!

Article title Horizontal Ruler Component - Decorative Section Dividers
Article author Anand Raja
Release time Oct 22, 2025
Copyright 2025
RSS Feed
Sitemap