Getting StartedComponentsDesign TokensThemingTheme SynthesizerFrameworksAccessibilityUtilitiesServer RenderingBrowser SupportContributingChangelogApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip
ARC UIARC Radiant Components
v4.9DocsComponentsTokensSynthesizer
Getting StartedFrameworksServer RenderingDesign TokensThemingTheme SynthesizerTypographyUtilitiesAll ComponentsAccessibilityBrowser SupportChangelogContributingStatsApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip

Responsive Switcher

Container-query-based layout that flips between horizontal and vertical at a threshold width. No media queries needed.

ComponentsResponsive Switcher
layoutstatic
<arc-responsive-switcher>

Overview

ResponsiveSwitcher is a layout primitive that uses CSS container queries to automatically switch its children between a horizontal (row) and vertical (column) arrangement based on the component's own width, not the viewport width. When the container is wider than the threshold, children are laid out side by side; when it narrows below the threshold, they stack vertically. Container queries beat media queries for component-level responsiveness because the same ResponsiveSwitcher works whether it lives in a full-width page section, a narrow sidebar, or a resizable split pane. The breakpoint depends on the component's container, not the viewport, so it can be reused across layouts. Common use cases include form layouts that go from two-column to single-column in narrow containers, card groups that stack when a sidebar is expanded, and hero sections with side-by-side text and image that stack on smaller screens. The `threshold` prop accepts any CSS length value (px, rem, ch), and the `gap` prop uses design system spacing tokens for consistent rhythm.

Guidelines

When to use

  • Use for form layouts that should go from multi-column to single-column in narrow containers
  • Use for hero sections with side-by-side text and image that stack on small screens
  • Set threshold to the minimum width at which horizontal layout is comfortable (e.g. "600px")
  • Combine with Container to get both width constraints and responsive switching
  • Use inside resizable panels or split panes where viewport media queries are unreliable

When not to use

  • Do not use ResponsiveSwitcher for complex multi-breakpoint layouts; use CSS Grid directly
  • Do not set threshold too low: the horizontal layout becomes cramped
  • Do not nest Responsive Switchers deeply: one level of switching is usually sufficient
  • Do not confuse ResponsiveSwitcher with Stack: Stack is always vertical, Switcher is conditional
  • Do not use for navigation menus; use a dedicated responsive navigation component instead

Features

  • CSS container queries for intrinsic responsive behavior: no media queries
  • Flips between horizontal (row) and vertical (column) layout at a configurable threshold
  • Threshold prop accepts any CSS length value (px, rem, ch)
  • Design-token-based gap spacing (sm, md, lg) for consistent rhythm
  • Works correctly regardless of where the component is placed (sidebar, main, split pane)
  • Pure CSS: no JavaScript resize observers or breakpoint calculations
  • CSS part: `switcher` for targeted ::part() styling

Preview

Wide container (horizontal):
Child A
Child B
Child C
Narrow container (vertical):
Child A
Child B
Child C

Usage

<arc-responsive-switcher threshold="600px" gap="md">
  <arc-card>First panel</arc-card>
  <arc-card>Second panel</arc-card>
  <arc-card>Third panel</arc-card>
</arc-responsive-switcher>

API

thresholdstring'600px'
The container width at which the layout switches between horizontal and vertical. Accepts any CSS length value. When the container is wider than this value, children are in a row; below it, they stack.
gap'xs' | 'sm' | 'md' | 'lg' | 'xl''md'
Spacing between children in both horizontal and vertical modes, mapped to design system spacing tokens.

See Also