suiss/ui ยท Block
Grid Accessories
A filterable accessories grid with category chips and add-to-bag buttons that update a bag counter.
Grid Accessories is an open-source block from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
A product grid with category filter chips and an add button on each card that turns into an In bag pill. A bag icon in the header shows the running count. Cards sit two per row on mobile and fill the width with auto-sized columns on desktop. Use it for accessory, add-on or catalog listings where shoppers add items straight from the grid.
Edit filters for the chips and accessories for the products; each product has a name, a category matching one of the filters, a formatted price and an image. Replace the local bag toggle with your cart logic.
The bag count is announced, and each add button names its product and exposes its pressed state. Product photos are Unsplash placeholders.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
- Install the following dependencies:
-
Add the pieces it builds on: Button, Toggle Group.
-
Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Web preview
Composes Screen, Chip filters, Button, Icon and Text. Category chips filter the grid, and each card's plus button expands into an In bag state while a badge on the bag icon shows the item count.
Replace ACCESSORIES and FILTERS with your catalog. Pass onAddToBag, onRemoveFromBag and onFilterChange to sync with your cart.
Installation
- Install the following dependencies:
-
Add the pieces it builds on: Button, Chip, Icon, Screen, Text.
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy and paste the following code into
components/blocks/grid-accessories.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Add the pieces it builds on: Button, Chip, Icon, Screen, Text.
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy and paste the following code into
components/blocks/grid-accessories.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Add the pieces it builds on: Button, Chip, Icon, Screen, Text.
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy and paste the following code into
components/blocks/grid-accessories.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.