Tessina UI
Tessina UI
GitHubIntroduction
InstallationUsageTheming
Components
ButtonIconButtonLinkSpinnerBadgeAvatarStatusChipShortcutSkeletonSurfaceProgressMeterRating
LabelFieldFieldsetCheckboxRadioSwitchSliderSelectComboboxSearchTextareaNumberFieldDate PickerTime PickerOTP InputFile UploadCalendar
AlertBannerToastTooltip
TabsAccordionCollapsibleBreadcrumbPaginationStepperSegmentedControlButtonGroupToggleButtonToggleGroupToolbarNavigation MenuMenubarBottom NavSidebar
Split ButtonFABDropdown MenuContextMenuCommandPopoverHoverCard
ContainerStackFlexGridAspectRatioSpacerCardCarouselDividerScroll Area
Table
ChatBubblePromptInputCodeBlock
ModalAlertDialogDrawerAction SheetTop Header MobileTop Header DesktopEmptyStateForm
Contributing
ComponentsLayout Blocks

Container

A layout primitive that constrains content to a maximum width, applies consistent horizontal padding, and centers it within the viewport. Seven sizes, seven padding presets, polymorphic rendering, and RTL support.

Playground

Installation

pnpm add @tessinaui/ui

Usage

import { Container } from "@tessinaui/ui";
<Container>
  <h1>Dashboard</h1>
</Container>

<Container size="sm" padding="responsive" render={<article />}>
  <p>A reading-width article with responsive gutters, rendered as &lt;article&gt;.</p>
</Container>

<Container size="full" padding="none">
  {/* full-bleed section — e.g. a coloured hero background */}
</Container>

Showcase

Sizes

Each size sets a max-width preset. Pick the narrowest size that still fits your content.

Sizemax-widthPixelsUse case
xsmax-w-md448pxForm dialogs, modal bodies, single column
smmax-w-2xl672pxReading column, comfortable prose width
mdmax-w-4xl896pxArticle or blog post
lgmax-w-6xl1152pxDefault — app content, settings pages
xlmax-w-7xl1280pxWide marketing page, dashboard
2xlmax-w-[96rem]1536pxUltra-wide dashboards, data tables
fullmax-w-none100%No constraint — full-bleed sections

Padding

Horizontal padding is applied inside the container. The responsive preset scales across breakpoints (tight on mobile, roomy on desktop) and is the default.

PaddingClassesUse case
nonepx-0When the parent already provides gutters
xspx-2 (8px)Dense layouts
smpx-4 (16px)Compact mobile
mdpx-6 (24px)Standard desktop gutter
lgpx-8 (32px)Generous desktop gutter
xlpx-12 (48px)Marketing pages, hero sections
responsivepx-4 md:px-6 lg:px-8 xl:px-12Default — scales with breakpoint

Centering

Container centers horizontally with mx-auto by default. Turn it off for left-aligned layouts:

<Container center={false}>
  {/* aligns to the start edge */}
</Container>

Polymorphic rendering

Use the render prop to keep Container's styling but render as a different semantic element. This is the same pattern Tessina's Button and Link use.

<Container size="md" render={<main />}>
  <h1>Page title</h1>
</Container>

<Container size="sm" render={<article />}>
  {/* blog post */}
</Container>

<Container size="lg" render={<section aria-label="Features" />}>
  {/* landing page section */}
</Container>

Nested containers

A common pattern is a wide outer container for chrome (header, hero background) and a narrower inner container for reading content:

<Container size="xl" padding="responsive">
  <Container size="sm" padding="none">
    <article>{/* reading-width prose */}</article>
  </Container>
</Container>

Full-bleed backgrounds

To paint a full-width background while keeping content constrained, wrap a narrower Container inside a size="full" one (or use a plain <div> for the background):

<Container size="full" padding="none">
  <div className="bg-foreground py-12">
    <Container size="lg" padding="responsive">
      <h1 className="text-background">Hero</h1>
    </Container>
  </div>
</Container>

RTL

Container is direction-agnostic for layout (max-width, mx-auto, symmetric padding). Pass dir="rtl" to propagate direction to descendants:

<Container dir="rtl">
  <article>محتوى</article>
</Container>

Accessibility

  • Container renders a plain <div> by default — attach semantic meaning via render where appropriate (<main>, <section>, <article>, <nav>, <aside>).
  • Container has no keyboard or focus behaviour of its own.
  • Avoid applying max-w to interactive elements directly; let Container absorb the constraint so your buttons, inputs, and links keep their natural hit area.

API Reference

Container

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full""lg"Maximum width preset
padding"none" | "xs" | "sm" | "md" | "lg" | "xl" | "responsive""responsive"Horizontal padding
centerbooleantrueApply mx-auto to center horizontally
renderReactElement—Render as another element (e.g. <main />) — styling is merged, semantics change
dir"ltr" | "rtl"—Text direction, propagated to descendants
classNamestring—Extra classes appended to the root element

The component extends all standard HTML attributes for the rendered element.

HoverCard

A floating card that appears when a trigger is hovered or focused. Use for lightweight previews — user profiles, link previews, citations, or footnote definitions. Built on Base UI's preview-card primitive.

Stack

A flex-based layout primitive for arranging items in a row or column. Configurable direction, gap, alignment, justification, wrapping, reversal, dividers, inline display, polymorphic rendering, and LTR/RTL support. Ships with HStack and VStack convenience wrappers.

On this page

PlaygroundInstallationUsageShowcaseSizesPaddingCenteringPolymorphic renderingNested containersFull-bleed backgroundsRTLAccessibilityAPI ReferenceContainer