No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

CardViewSwitcher

A simple 2 button toggle to switch. Usually used to switch the type of layout to be shown on a SearchResults widget.

Properties

Property NameDescriptionTypeRequired
onToggleToggle value handler(newValue: string) => voidtrue
defaultCardViewDefault value for the component.Possible values: grid , listtrue
GridIconIcon for the grid viewReact.FCtrue
ListIconIcon for the list viewReact.FCtrue

Example


import { GridIcon, ListBulletIcon } from '@radix-ui/react-icons';
import CardViewSwitcher from '@/components/CardViewSwitcher';

...

  <CardViewSwitcher
    onToggle={(value) => { console.log(value)}}
      defaultCardView={'list'}
      GridIcon={GridIcon}
      ListIcon={ListBulletIcon}
  />
  

Installation

npx sc-search new-component -w -s styled -l typescript -n CardViewSwitcher -o <destination/path>