5.1.1 • Published 1 day ago

@purpurds/chip-group v5.1.1

Weekly downloads
-
License
AGPL-3.0-only
Repository
-
Last release
1 day ago

import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";

import as ChipGroupStories from "./src/chip-group.stories"; import as ChipGroupItemStories from "./src/chip-group-item.stories"; import packageInfo from "./package.json";

ChipGroup

Version {packageInfo.version}

This component can be used both as a Filter Chip (multiple choice) and Choice Chip (single choice) component. The type prop determines which type of component will be used.

Showcase

Properties

ChipGroup

ChipGroupItem

Installation

Via NPM

Add the dependency to your consumer app like "@purpurds/purpur": "^x.y.z"

In MyApp.tsx

import "@purpurds/purpur/styles";

In MyComponent.tsx

import { useState } from "react";
import { ChipGroup } from "@purpurds/purpur";

export const MyComponent = () => {
  const [value, setValue] = useState("one");

  return (
    <ChipGroup type="choice" value={value} onValueChange={setValue}>
      <ChipGroup.Item value="one">Option 1</ChipGroup.Item>
      <ChipGroup.Item value="two">Option 2</ChipGroup.Item>
    </ChipGroup>
  );
};
import { useState } from "react";
import { ChipGroup } from "@purpurds/chip-group";

export const MyComponent = () => {
  const [value, setValue] = useState<string[]>([]);

  return (
    <ChipGroup type="filter" value={value} onValueChange={setValue}>
      <ChipGroup.Item value="one">Option 1</ChipGroup.Item>
      <ChipGroup.Item value="two">Option 2</ChipGroup.Item>
    </ChipGroup>
  );
};
5.1.1

1 day ago

5.1.0

8 days ago

5.0.0

14 days ago

4.5.0

16 days ago

4.6.0

15 days ago

4.5.1

15 days ago

4.4.0

19 days ago

4.3.0

28 days ago

4.2.0

28 days ago

4.1.1

1 month ago

4.1.0

1 month ago

4.0.2

1 month ago

4.0.1

1 month ago

4.0.0

2 months ago

3.7.1

2 months ago

3.7.0

2 months ago

3.6.0

2 months ago

3.5.1

2 months ago

3.5.0

2 months ago

3.4.0

2 months ago

3.3.2

2 months ago

3.3.1

2 months ago

3.3.0

2 months ago

3.2.0

2 months ago

3.1.0

2 months ago

3.0.1

3 months ago

3.0.0

3 months ago

2.8.0

3 months ago