0.4.1 • Published 2 years ago

@cos-ui/primitives v0.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@cos-ui/primitives

Headless UI components for React

Getting started

  1. Install the package
$ npm install @cos-ui/primitives
  1. Import the parts

Import and structure the parts.

import { Tab } from '@cos-ui/primitives';

const TabDemo = () => (
  <Tab.Group>
    <Tab.List>
      <Tab>Tab A</Tab>
      <Tab>Tab B</Tab>
    </Tab.List>
    <Tab.Panels>
      <Tab.Panel>Tab Panel 1</Tab.Panel>
      <Tab.Panel>Tab Panel 2</Tab.Panel>
    </Tab.Panels>
  </Tab.Group>
);

You can styling your component using styled of styled-components.

import { Tab } from '@cos-ui/primitives';
import styled from 'styled-components';

const StyledTab = styled(Tab)`
  /* style */
`;

const StyledTabList = styled(Tab.List)`
  /* style */
`;

const StyledTabPanel = styled(Tab.Panel)`
  /* style */
`;

StyledTab.Group = Tab.Group;
StyledTab.List = StyledTabList;
StyledTab.Panels = Tab.Panels;
StyledTab.Panel = StyledTabPanel;

// OR

const StyledTabRoot = styled(Tab)`
  /* style */
`;

const StyledTab = Object.assign(StyledTab, {
  Group: Tab.Group,
  List: StyledTabList,
  Panels: Tab.Panels,
  Panel: StyledTabPanel,
})

export default StyledTab;
0.4.1

2 years ago

0.4.0

2 years ago

0.3.2

2 years ago

0.3.3

2 years ago

0.3.0

2 years ago

0.3.1

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago