EnterUI
DocsComponentsThemesExamplesDonation
Get Started
      • Container
      • Spacer
      • VStack
      • HStack
      • ZStack
      • Grid
      • LazyVGrid
      • LazyHGrid

Default usage

  1. EnterUI
  2. /Docs
  3. /Layout and Utilities
  4. /Layout Primitives
  5. /Containers
  6. /HStack
Updated 3 October 2026

HStack

A horizontal layout primitive inspired by SwiftUI.

HStack arranges children horizontally for toolbars, metadata rows, card headers, and compact product controls.

By default, HStack uses align="center", justify="start", and gap={8}.

#Default usage

HStack

Use HStack when the layout direction is explicitly horizontal.

EUEnterUIStable
Code
<HStack gap={8} align="center">
  <Avatar><AvatarFallback>EU</AvatarFallback></Avatar>
  <Text as="span" weight="semibold">EnterUI</Text>
  <Badge variant="success">Stable</Badge>
</HStack>

#Import

Code
import { Avatar, Button, HStack } from "@froggdesign/enter-ui-react";

#Alignment

Alignment

Baseline alignment is useful for mixed text sizes.

97.1Kfollowers

#Density

Gap scale

Use smaller gaps in dense controls and larger gaps in headers.

SmMdLg

#Patterns

Wrapping rows

Wrap keeps toolbar-like content responsive on narrow screens.

Docs

#Accessibility

HStack is layout-only. Use semantic children and choose as="nav" with an accessible label for navigation rows.

#API

  • as: div, section, article, main, aside, nav, header, or footer.
  • gap: 0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, or 48.
  • align: start, center, end, stretch, or baseline.
  • justify: start, center, end, or between.
  • wrap: enables flex wrapping.
  • fullWidth: sets width to 100%.
  • top, right, bottom, left: external spacing (margin).
  • padding, paddingTop, paddingRight, paddingBottom, paddingLeft: internal spacing.
  • Extends native props for the rendered element and supports className.

#Spacing

Code
<HStack top={12} right={16} padding="1.25rem" gap={12} align="center">
  <Badge>Live</Badge>
  <Text size="sm" tone="muted">
    Right margin and internal padding are applied directly by props.
  </Text>
</HStack>

#Styling

HStack uses .eui-hstack with data attributes for gap, align, justify, wrap, and full-width behavior. Use it for rows and toolbar-like layouts before adding custom flex wrappers.

PreviousVStack
NextZStack
On this page
  • Default usage
  • Import
  • Alignment
  • Density
  • Patterns
  • Accessibility
  • API
  • Spacing
  • Styling