Product Options Toggle

Filter Products by their options.

  • Component: <ProductTypeToggle/>

  • Path: /components/home/product-type-toggle.tsx

  • Import:

import { ProductTypeToggle } from "@/components/home/product-type-toggle.tsx";

This simple Toggle allows users to filter out products depending on the options you defined in your /data/config/metadata.js file (option1Label)

By default all products are shown regardless of their options. You can modify this behavior by updating defaultPressed :

product-type-toggle.tsx
<Toggle
    value="option1"
    aria-label={`Toggle ${metadata.option1Label}`}
    onClick={() => handleToggle("option1")}
    defaultPressed={selectedProductTypes.includes("option1")}
>

Last updated