NV Elements Catalog Starters Repo System Themes About Getting Started Changelog Metrics Support Accessibility Contributions Requests Migration Deprecations Integrations Installation MCP CLI Lint Angular Bundles Extensions Go Hugo Import Maps Lit NextJS Nuxt Preact React SolidJS Svelte TypeScript Vue Foundations Typography Iconography Themes Design Tokens Size & Space Objects Interactions Support Status Color Animation Fonts Layers Custom Layout Horizontal Vertical Grid Popovers i18n Visualization View Transitions Elements Accordion Alert Avatar Badge Breadcrumb Button Button Group Card Chat Message Checkbox Color Combobox Copy Button Datagrid Integrations Column Action Column Alignment Column Fixed Column width Container Card Display Settings Footer Heatmap Keynav Multi Select Pagination Panel Detail Panel Grid Performance Placeholder Row Action Row Groups Row Sort Scroll Height Single Select Stripe Date Datetime Dialog Divider Dot Drawer Dropdown Dropdown Group Dropzone File Forms Validation Actions Control Icon Icon Button Input Input Group Logo Menu Month Notification Page Page Header Page Loader Pagination Panel Progressive Filter Chip Progress Bar Progress Ring Password Preferences Input Pulse Radio Range Resize Handle Search Select Skeleton Sort Button Sparkline Star Rating Steps Switch Tabs Tag Textarea Time Toast Toggletip Toolbar Tooltip Tree Week Patterns Authentication Browse Dashboard Editor Empty States Heatmap Keyboard Shortcut Logging Media Onboarding Panel Responsive Search Subheader Trend Code Codeblock Monaco Input Diff Input Editor Diff Editor Problems Markdown Markdown CSS Utility Labs Responsive Layout Viewport Container Patterns Forms API Design Properties & Attributes Slots Registration CustomEvents Stateless Composition Styles Packaging Glossary Logs Internal Guidelines Agent Harness Documentation Examples TypeScript Testing Unit Testing Accessibility Testing Lighthouse Testing SSR Testing Visual Testing Troubleshooting Component Creation Internal Examples All Examples
Labs projects are experimental packages available for early feedback.

Responsive Layout - Container

By optionally importing the responsive container layout module, you extend the nve-layout system using CSS Container Queries for adaptive responsive design based on the container element's width rather than just the browser width.

Learn more about container queries in this Google web.dev video and article.

The responsive layout API applies conditional styling based on parent element width. Supported features include gap, padding, row vs column, reversing flex direction, and varying grid structure across defined pixel width breakpoints.

The following set of container breakpoint-values defines:

  • xs = 160px
  • sm = 320px
  • md = 480px
  • lg = 640px
  • xl = 800px
  • xxl = 960px

The ampersand-based &breakpoint-size|... API adds the breakpoint size before the layout modifier.

Conditional gap sizing example: nve-layout="row &sm|gap:xxxs &md|gap:md &lg|gap:xxl". The size value after the : corresponds to one of the nine spacing/padding system values.


    
The extra div wrapper explicitly defines the container element for queries. This design keeps the utility minimal—elements with & syntax automatically use their parent as the container without requiring manual container specification.

Responsive Gap Sizing

The following container query breakpoints are available for gap, replace ... with one of the 9 gap spacing values:

  • &xs|gap:...
  • &sm|gap:...
  • &md|gap:...
  • &lg|gap:...
  • &xl|gap:...
  • &xxl|gap:...

Responsive Padding

The following container query breakpoints are available for padding, replace ... with one of the 9 padding values:

  • &xs|pad:...
  • &sm|pad:...
  • &md|pad:...
  • &lg|pad:...
  • &xl|pad:...
  • &xxl|pad:...

Breakpoints for Switching Flexbox Layout Direction

The following container query breakpoints are available for swapping flex direction:

Horizontally

  • &xs|row
  • &sm|row
  • &md|row
  • &lg|row
  • &xl|row
  • &xxl|row

Vertically

  • &xs|column
  • &sm|column
  • &md|column
  • &lg|column
  • &xl|column
  • &xxl|column

Reverse Direction

Also, you can use the following syntax for flipping the flex direction:

  • &...|row-reverse
  • &...|column-reverse

Responsive Grid

You can vary grid structure based on container size using the following syntax with nve-layout=grid...:


    

Or:


    

Responsive Grid Parent

Responsive Grid Items

Hiding Elements Based on Container Size

Since hiding elements only affects the display of the element itself and not the layout of its children, responsive visibility control uses the nve-display attribute.

Element visibility (hiding) uses the separate nve-display attribute rather than nve-layout. This distinction exists because visibility control only affects the element itself, while layout properties affect how the parent arranges children.

The following attributes are available for hiding elements at specific container breakpoints and below:

  • nve-display="hide"
  • nve-display="&xs|hide"
  • nve-display="&sm|hide"
  • nve-display="&md|hide"
  • nve-display="&lg|hide"
  • nve-display="&xl|hide"
  • nve-display="&xxl|hide"

You may want to now show elements at smaller container widths. The following attributes are available for showing elements at specific container breakpoints and below:

  • nve-display="&xs|show"
  • nve-display="&sm|show"
  • nve-display="&md|show"
  • nve-display="&lg|show"
  • nve-display="&xl|show"
  • nve-display="&xxl|show"

Summary

The container query responsive system allows elements to adapt based on their container's width using the & prefix. Remember:

  • Layout properties (gap, padding, row/column, grid) use nve-layout
  • Visibility control (hide/show) uses nve-display
  • Container queries use the parent element to establish the container context
  • Breakpoints range from xs (160px) to xxl (960px)

Example combining both: