DocSpace-client/packages/shared/components/view-selector
2024-03-21 18:09:55 +04:00
..
index.tsx Replaced copyright start year + format 2024-03-21 18:09:55 +04:00
README.md Shared:Components:ViewSelector: rewrite to typescript 2023-12-18 11:12:13 +03:00
ViewSelector.stories.tsx Replaced copyright start year + format 2024-03-21 18:09:55 +04:00
ViewSelector.styled.ts Replaced copyright start year + format 2024-03-21 18:09:55 +04:00
ViewSelector.test.tsx Replaced copyright start year + format 2024-03-21 18:09:55 +04:00
ViewSelector.tsx Replaced copyright start year + format 2024-03-21 18:09:55 +04:00
ViewSelector.types.ts Replaced copyright start year + format 2024-03-21 18:09:55 +04:00

ViewSelector

Actions with a button.

Usage

import { ViewSelector } from "@docspace/shared/components";
import ViewRowsReactSvgUrl from "PUBLIC_DIR/images/view-rows.react.svg?url";
import ViewTilesReactSvgUrl from "PUBLIC_DIR/images/view-tiles.react.svg?url";

View Settings

const viewSettings = [
  {
    value: "row",
    icon: ViewRowsReactSvgUrl,
  },
  {
    value: "tile",

    icon: ViewTilesReactSvgUrl,
    callback: createThumbnails,
  },
];
<ViewSelector
  isDisabled={false}
  onChangeView={(view) => console.log("current view:", view)}
  viewSettings={viewSettings}
  viewAs="row"
  isFilter={false}
/>

Properties

Props Type Required Values Default Description
isDisabled bool - - - Disables the button default functionality
isFilter bool - - - Show only available option icon in selector
onChangeView func - - - The event triggered when the button is clicked
viewSettings arr - - - Array containing view settings.
viewAs string - - - Current application view