Component: Button¶
Purpose¶
Creates a clickable button, typically used for links or calls to action.
When to Use¶
- Linking to other pages on your site (e.g., "Learn More", "Contact Us").
- Linking to external websites.
- Highlighting the main action within a
CallToActioncomponent. - Creating eye-catching call-to-action elements in your content.
How to Use (Options / Props)¶
You add options (called "props") inside the opening tag <Button ... >. The text you want inside the button goes between the opening <Button> and closing </Button> tags.
Option (prop) |
Description | Required? | Example Value(s) |
|---|---|---|---|
href |
The web address (URL) the button links to. | Yes | /about, /pricing/pro, https://google.com |
variant |
The style of the button. | No | primary, secondary, outline, ghost, link, destructive (Default: primary) |
size |
The size of the button. | No | default, sm, lg, icon (Default: default) |
children |
The text displayed inside the button. | Yes | Put text between tags |
Example MDX Usage¶
Simple Primary Button:
Secondary Button Linking Externally:
Outlined Button (smaller size):
Large Call-to-Action Button:
Ghost Button (subtle style):
Link-styled Button (looks like a link, acts like a button):
Button inside paragraph text:
Button Variants Explained¶
primary: Bold, primary action button with filled background (default)secondary: Softer style for secondary actionsoutline: Button with border, transparent backgroundghost: Minimal style, shows background only on hoverlink: Styled like a text link but with button behaviordestructive: Red style for dangerous actions (use sparingly)
Button Sizes¶
default: Standard button size (good for most uses)sm: Smaller, compact buttonlg: Larger, more prominent buttonicon: Square button for icon-only content