Directory
- Welcome
Logo Component
The Logo component provides a flexible way to display your brand identity with automatic dark mode support. It intelligently handles logo variations and ensures optimal display across different color schemes.
Key Features
-
Dark Mode Support: Automatically switches between light and dark variants
-
Responsive Design: Maintains aspect ratio across screen sizes
-
Flexible Sizing: Adapts to container dimensions
-
Fallback Handling: Gracefully handles missing dark mode variants
Basic Usage

<Logo />
Configuration Options
Dark Mode Support
The component automatically handles dark mode switching, if you want to disable it, you can set the darkMode
prop to false
then the same image will be used in both themes:


<Logo alt="Company Name" />
<!-- Without dark mode -->
<Logo darkMode={false} alt="Company Name" />
Logo Setup
- Place your logo files in
src/assets/logos/
- Light theme:
logo.png
- Dark theme:
logo-dark.png
- Light theme:
src/ βββ assets βββ logos βββ logo.png βββ logo-dark.png
Logo Component Props API
Prop | Type | Default | Description |
---|---|---|---|
darkMode | boolean | true | Enable dark mode variant switching |
alt | string | CONFIG.BUSINESS_NAME Logo | Alternative text for accessibility |
Best Practices
-
Image Preparation
- Use PNG format for transparency support
- Maintain consistent dimensions between variants
- Optimize image files for web use
- Ensure sufficient contrast in both modes
-
Accessibility
- Provide meaningful alt text
- Consider color contrast for linked logos
- Test navigation with keyboard controls
- Ensure proper ARIA attributes
-
Responsive Design
- Test logo appearance at various sizes
- Verify dark mode transitions
- Ensure proper scaling behavior
- Consider mobile viewports
Technical Details
-
Uses Astroβs built-in Image component for optimization
-
Dynamically imports dark mode variant
-
Maintains aspect ratio through object-fit containment
-
Gracefully falls back to light variant if dark is unavailable
Limited Time Launch Sale
Start building your branded website with our pre-built Logo component. Get the AstroJS starter template now and implement professional branding in minutes.
GET 60% OFF!