Introducing container queries to a component library
Container queries let a component respond to its available inline size rather than the viewport, but they work best when containment and layout responsibilities are explicit.
Name the containing boundary
Apply containment at the layout wrapper that genuinely owns available width. Avoid turning every nested element into a query container; unnamed and overlapping boundaries make later component behaviour difficult to diagnose.
Define component transitions
Choose thresholds from content pressure such as line length, control wrapping and media size. Keep page-level columns in the page layout and use container queries for changes internal to the component.
Ship a stable baseline
Write the unqueried style as a usable narrow layout, then enhance within @container rules. Test nested components, writing modes, browser zoom and long translated content before replacing established media-query behaviour.
A container threshold belongs to the component and should be documented beside its supported variants, not copied into each consuming page.