1.0.38 • Published 8 months ago

@candour-ui/react v1.0.38

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

Digit Tally Component Library

Introduction

The Digit Tally Component Library is a collection of reusable React components designed to simplify the development of user interfaces. This library provides a set of well-crafted components that can be easily integrated into your projects, ensuring a consistent look and feel while saving development time. Whether you're building a small application or a large-scale project, these components are flexible, customizable, and ready to use.

Key Features

  • Customizable Components: Each component comes with a variety of props for customization, allowing you to tailor styles and behavior to your needs.
  • Accessibility: Designed with accessibility in mind to ensure your applications are usable by everyone.
  • Lightweight: The library is lightweight and optimized for performance, ensuring a smooth user experience.
  • Responsive Design: Components are built to be responsive, adapting to different screen sizes seamlessly.

Installation

To install the library, you can use npm or yarn:

npm install @candour-ui/react

or

yarn add @candour-ui/react

Button Component

Usage

<Button
  type="submit"
  variant="solid"
  disabled
  plusIcon
  className="submitButton"
  onClick={() => console.log('Button clicked!')}
>
  Submit
</Button>

Dropdown Component

DropdownItem

PropTypeDefaultDescription
childrenReactNode-Dropdown item to display.
itemKeystring-Unique key for the item.
paddingstring-Padding style for the item.
fontstring-Font style for the item.
colorstring-Text color for the item.

DropDownMenu

PropTypeDefaultDescription
childrenReactNode-Dropdown items to display.
bgstring-Background color for the menu.
paddingstring-Padding style for the menu.
sizestring-Size of the menu.
radiusstring-border radius of the DropDown.
shadowstring-box shadow of the DropDown.
onAction(key: string) => void-Called when an item is selected.

DropdownTrigger

PropTypeDefaultDescription
childrenReactNode-Content inside the trigger.

DropdownWrapper

PropTypeDefaultDescription
childrenReactNode-Trigger and menu items.
positionstring-Positioning of the menu.
otherPropsobject-Additional props for context.

Usage

<DropdownWrapper>
  <DropdownTrigger>
    <Button type="button" variant="solid" onClick={() => {}}>
      Trigger Drop Down
    </Button>
  </DropdownTrigger>

  <DropDownMenu
    onAction={handleDropDownAction}
    size="lg"
    radius="md"
    shadow="xl"
  >
    <DropdownItem itemKey="new" text="New file" />
    <DropdownItem itemKey="old" text="Old file" />
  </DropDownMenu>
</DropdownWrapper>

Popover Component

Popover

PropTypeDefaultDescription
popoverIdstring-Unique ID for the popover.
childrenReactNode-Content inside the popover.
closeOnBackdropClickbooleantrueCloses popover on backdrop click.
positionstring-Positioning of the popover.

PopoverTrigger

PropTypeDefaultDescription
childrenReactNode-Content inside the trigger.

PopoverContent

PropTypeDefaultDescription
childrenReactNode-Content inside the popover.
bgstring-Background color for the content.
paddingstring-Padding style for the content.
sizestring-Size of the content.

Usage

<Popover>
  <PopoverTrigger>
    <button>Open Popover</button>
  </PopoverTrigger>
  <PopoverContent variant="solid" position="bottom">
    <p>Popover content (bottom)!</p>
  </PopoverContent>
</Popover>

Modal

PropTypeDefaultDescription
modalIdstring-Unique ID for the modal.
childrenReactNode-Content inside the modal.
closeOnBackdropClickbooleantrueCloses modal on backdrop click.

Usage

<Modal modalId="modalId" closeOnBackdropClick>
  <div>This is the modal content</div>
</Modal>

Toast

Prop NameTypeDefaultDescription
actionstring-Title or label of the toast.
toastIdstring-Unique ID for the toast.
messagestring-Content displayed in the toast.
closeButtonbooleanfalseShows a close button if true.
durationnumber5000Time in milliseconds before the toast automatically closes.
position'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right''top-right'Defines the corner of the screen where toasts appear.
variant'default' \| 'success' \| 'error' \| 'info' \| 'warning' \| 'promise''default'Sets the visual style of the toast based on its type.

Usage

<Toast
  action="Success"
  toastId="toastId"
  message="Item deleted successfully."
  variant="info"
  position="top-right"
  closeButton
/>

Toast Container

Usage

Place the ToastContainer at the root of your app or in a specific component

<ToastContainer />

ToggleTheme

-

<ToggleTheme />

Filter Component

Filter

PropTypeDefaultDescription
childrenReactNode-The trigger and menu items of the filter button.
variant'solid' or 'outline''outline'Style variant of the filter button.

FilterTrigger

PropTypeDefaultDescription
labelstring-The text label for the filter button.
arrowDownbooleanfalseIf true, shows an arrow-down icon in the button.
filterIconbooleanfalseIf true, displays a filter icon in the button.
iconPosition'left' or 'right''right'Determines the position of the icon in the button.
classNamestring-Additional class names for custom styling.
disabledbooleanfalseIf true, the button is disabled.

FilterMenu

PropTypeDefaultDescription
childrenReactNode-List of filter items to display in the menu.
onSelectionChange(value: string) => void-Callback when a filter item is selected.
selectedKeystring-Key of the currently selected filter item.
classNamestring-Additional class names for custom styling.

FilterItem

PropTypeDefaultDescription
valuestring-The value that represents the filter item.
childrenReactNode-The content to be displayed in the item.

Usage

<Filter>
  <FilterTrigger
    label="Filter"
    arrowDown
    iconPosition="right"
    variant="solid"
  />

  <FilterMenu onSelectionChange={handleFilterChange} selectedKey={selectedKey}>
    <FilterItem value="new">New Item</FilterItem>
    <FilterItem value="popular">Popular Item</FilterItem>
    <FilterItem value="old">Old Item</FilterItem>
  </FilterMenu>
</Filter>

Sort Component

Sort

PropTypeDefaultDescription
childrenReactNode-The trigger and menu items of the sort component.
onChange(value: string) => void-Callback function triggered when a sort item is selected.

SortTrigger

PropTypeDefaultDescription
labelstring-The text label for the sort button.
arrowDownbooleanfalseIf true, shows an arrow-down icon in the button.
sortIconbooleanfalseIf true, displays a sort icon in the button.
classNamestring-Additional class names for custom styling.
disabledbooleanfalseIf true, the button is disabled.

SortMenu

PropTypeDefaultDescription
childrenReactNode-List of sort items to display in the menu.
onSelectionChange(value: string) => void-Callback when a sort item is selected.
selectedKeystring-Key of the currently selected sort item.
classNamestring-Additional class names for custom styling.

SortItem

PropTypeDefaultDescription
valuestring-The value that represents the sort item.
onClickMouseEventHandler<HTMLLIElement>-Handler called when the item is clicked.
childrenReactNode-The content to be displayed in the item.

Usage

<Sort onChange={handleChange}>
  <SortTrigger sortIcon arrowDown label="Sort" />
  <SortMenu selectedKey={selected} onSelectionChange={handleChange}>
    {data.map((item) => (
      <SortItem value={item.value} key={item.label}>
        {item.label}
      </SortItem>
    ))}
  </SortMenu>
</Sort>
1.0.38

8 months ago

1.0.37

8 months ago

1.0.29

8 months ago

1.0.32

8 months ago

1.0.31

8 months ago

1.0.30

8 months ago

1.0.36

8 months ago

1.0.35

8 months ago

1.0.22

8 months ago

1.0.21

8 months ago

1.0.20

8 months ago

1.0.26

8 months ago

1.0.25

8 months ago

1.0.24

8 months ago

1.0.23

8 months ago

1.0.28

8 months ago

1.0.27

8 months ago

1.1.6

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

8 months ago

1.1.1

8 months ago

1.1.2

8 months ago

1.1.0

8 months ago

1.0.9

8 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago