{
  "id": "flex-switcher",
  "name": "Flex Switcher",
  "category": "layouts",
  "tags": [
    "switcher",
    "flexbox",
    "responsive",
    "no media query",
    "columns",
    "stack"
  ],
  "description": "Items sit in a row until the container gets too narrow, then all stack at once. No media queries.",
  "url": "https://copy-css.com/snippets/flex-switcher",
  "markdown": "https://copy-css.com/snippets/flex-switcher.md",
  "html": "<div class=\"switcher\">\n  <div>One</div>\n  <div>Two</div>\n  <div>Three</div>\n</div>",
  "css": ".switcher {\n  --threshold: 30rem; /* below this width, everything stacks */\n  display: flex;\n  flex-wrap: wrap;\n  gap: 16px;\n}\n\n/* Wide: negative basis, so they share a row.\n   Narrow: huge basis, so each takes a full row. */\n.switcher > * {\n  flex-grow: 1;\n  flex-basis: calc((var(--threshold) - 100%) * 999);\n}",
  "features": [
    "Flexbox",
    "custom properties"
  ],
  "customProperties": [
    {
      "name": "--threshold",
      "value": "30rem"
    }
  ]
}
