We use cookies to ensure you get the best experience on our website. Read our privacy policy

Skip to main content

Directory

Button Component

The Button component provides acts as the foundation for many of the components in this library. It supports multiple variants, sizes, and can function as either a button or link.

  • Check Circle

    Flexible Variants: Seventeen distinct styles for different contexts

  • Check Circle

    Responsive Sizing: Five size options to fit any layout

  • Check Circle

    Icon Support: Seamless integration with icons

  • Check Circle

    Link Capability: Functions as both button and link

  • Default: Primary actions and main calls-to-action
  • Secondary: Alternative or complementary actions
  • Input: Styled to look like an input field, used for select, dropdown, datepicker, etc.
  • Destructive: Actions that require caution or delete operations
  • Transparent: Subtle interactions within content
  • Link: Text-based navigation while maintaining button behavior
  • Icon: Compact, icon-only actions

Buttons come in five sizes to fit different contexts:

To style the input variant, pass the inputVariant prop either true to have the default input styling or an object to have the input variant styling. It matches the input variants from the input component.

The disabled state is applied to the button when the disabled prop is set to true.

Basic Buttons
---
import Button from '@/components/NST-components/UI/button/Button.astro';
import close from '@/assets/icons/close.svg?raw';
---
<!-- Standard Button -->
<Button variant="default" size="default"> Click Me </Button>
<!-- Link Button -->
<Button variant="link" href="/about"> About Us </Button>
<!-- Icon Button -->
<Button variant="icon" icon={close} size="lg" />
<!-- Disabled State -->
<Button variant="default" disabled> Unavailable </Button>
<Button inputVariant disabled> Input Style </Button>
Button Component Extends <button> HTMLElement
Prop Type Default Description
disabled boolean false Disables button interaction
href string | url | null Optional URL for link functionality
icon string SVG string for icon content
iconPosition left | right left Position of the icon
iconProps Omit<IconProps, "svg"> Props for the Icon component
inputVariant boolean | Partial<VariantProps<typeof inputVariants>> Input variant for the button
size fit | sm | md | default | lg default Size of the button
target HTMLAttributeAnchorTarget Link target attribute
variant default | secondary | destructive | transparent | link | icon | gradient | frost | neon | push | outlineGlow | retro | pulse | shine | magnetic | elegant | soft | modern default Visual style of the button

Add icons to enhance button clarity:

<Button variant="default" iconPosition="right" iconProps={{ class: 'ml-1' }} icon={arrowRight}>
Next
</Button>

/>

Buttons with href attribute will use the <a> anchor element while maintaining button styling:

  • Check Circle

    Button Text

    • Use action verbs
    • Keep text concise
    • Be descriptive
    • Maintain consistency
  • Check Circle

    Visual Hierarchy

    • Use primary variant for main actions
    • Limit destructive buttons
    • Group related buttons
    • Maintain adequate spacing
  • Check Circle

    Responsive Design

    • Consider mobile touch targets
    • Adapt size to viewport
    • Ensure readable text
    • Test across devices

Form submissions

Navigation triggers

Modal controls

Action confirmations

Toggle operations

Download triggers

Social sharing

Settings controls

Limited Time Launch Sale

Build professional interfaces faster with our pre-built Button component. Get the AstroJS starter template now and access a complete UI toolkit.

GET 60% OFF!
North Star Themes Logo

Subscribe to our newsletter

Get the latest AstroJS tips and tricks right to your inbox

Email: [email protected]

© 2025 North Star Themes

Web Kit Provided By North Star Themes