1.1.13 • Published 1 year ago

quant-ui-react v1.1.13

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

quant-ui-react

quant-ui-react is a collection of React components designed for building user interfaces with consistent styles and behaviors.

Installation

npm install quant-ui-react
# or
yarn add quant-ui-react

Components

Checkbox

Props

NameTypeDefault ValueDescription
variantSize"sm", "md", "lg", "xl""md"Specifies the size of the checkbox.
labelstringNoneLabel text for the checkbox.
isLabelbooleanfalseSpecifies whether to show the label text or not.
labelClassNamestringNoneAdditional CSS classes for the label text.

Button

Props

NameTypeDefault ValueDescription
variant"default", "danger", "warning", "success""default"Specifies the size of the button.
variantSize"default", "sm", "lg", "icon""default"Specifies the size of the button.
asChildbooleanfalseSpecifies if the button is a child of another component.

Input

Props

NameTypeDefault ValueDescription
variant"outlined", "standard""outlined"Specifies the variant of the input field.
labelstringNoneLabel text for the input field.
type"text", "password""text"Specifies the type of input field.

Modal

Props

NameTypeDefault ValueDescription
isOpenbooleanfalseSpecifies whether the modal is open or closed.
onClose() => voidNoneCallback function to close the modal.

Seekbar

Props

NameTypeDefault ValueDescription
accentColorstring"#3B82F6"Color of the seekbar thumb.
progressColorstring"#3B82F6"Color of the progress bar.
seekbarColorstring"#D1D5DB"Color of the seekbar bar.
valuestringNoneCurrent value of the seekbar.
maxnumber or string100Maximum value of the seekbar.
minnumber or string0Minimum value of the seekbar.

InputOtp

Props

NameTypeDefault ValueDescription
elementsnumber6Specifies the number of input boxes
variant"sm" , "md" , "lg" , "xl""md"Specifies the variant of the input field.
onOtpChange(values: string) => void-Callback function triggered when the OTP values change

Avatar

Props

NameTypeDefault ValueDescription
srcstringSpecifies the source URL of the image.
altstringSpecifies the alternate text for the image.
variantSize"sm", "md", "lg", "xl""md"Specifies the size variant of the avatar.
fallbackSrcstring"default-fallback-image.jpg"Specifies the fallback image URL if the src is not provided or fails to load.

Badge

Props

NameTypeDefault ValueDescription
variant"default", "secondary", "destructive", "outline""default"Specifies the visual variant of the badge.

Toast

Props

NameTypeDefault ValueDescription
positionToastPositionSpecifies the position of the toast.
durationnumber2000Duration in milliseconds for the toast to show.
reverseOrderbooleanfalseSpecifies whether to reverse the order of toasts.
gutternumber8Space between toasts in pixels.

ToastTrigger

Props

NameTypeDefault ValueDescription
ctastringText displayed in the toast trigger button.
typeOfToast"default", "success", "error", "promise""default"Type of toast triggered when the button is clicked.
promiseLoadingTextstring"Saving..."Text displayed when the promise is in loading state.
promiseLoadingSuccessstring"Saved!"Text displayed when the promise resolves successfully.
promiseLoadingErrorstring"Could not save."Text displayed when the promise fails to resolve.
promiseFn() => PromiseFunction returning a promise to handle 'promise' type toast.

BarLoader

Props

NameTypeDefault ValueDescription
sizenumber45Specifies the size of the loader.

DotLoader

Props

NameTypeDefault ValueDescription
sizenumber45Specifies the size of the loader.

SpinnerLoader

Props

NameTypeDefault ValueDescription
sizenumber45Specifies the size of the loader.
colorstring"#000"Specifies the color of the loader.

Radio

Props

NameTypeDefault ValueDescription
accentColorstring"#000"Specifies the accent color of the radio button.
isLabelbooleanfalseSpecifies whether to show the label text or not.
labelstringNoneLabel text for the radio button.
labelClassNamestringNoneAdditional CSS classes for the label text.
variantSize"sm", "md", "lg", "xl""md"Specifies the size of the radio button.

AccordionItem

Props

NameTypeDefault ValueDescription
isOpenbooleanNoneSpecifies whether the AccordionItem content should be visible or hidden.
contentstring | ReactElementNoneThe content to display within the AccordionItem when it is expanded.

AccordionTrigger

Props

NameTypeDefault ValueDescription
titlestringNoneThe title or label displayed for the AccordionTrigger.
isOpenbooleanNoneSpecifies whether the associated AccordionItem is currently expanded.
iconColorstring"black"The color of the icon displayed next to the title (if any).
onOpen() => voidNoneCallback function triggered when the AccordionTrigger is clicked.

Select

Props

NameTypeDefault ValueDescription
optionsArray<{ value: string; label: string }>RequiredArray of option objects, each containing value and label.
labelstringNoneOptional label text for the select element.
placeholderstringNonePlaceholder text for the select element.
labelClassNamestringNoneAdditional CSS classes for the label text.
valuestringNoneThe selected value of the select element.
onChange(event: React.ChangeEvent) => voidNoneFunction called when the selected value changes.

ChipInput

Props

NameTypeDefault ValueDescription
chipsstring[]NoneArray of chip values to be displayed.
onChipsChange(chips: string[]) => voidNoneCallback function to handle changes to the chips array.
inputClassNamestringNoneAdditional CSS classes for the input element.
chipClassNamestringNoneAdditional CSS classes for individual chips.
chipContainerClassNamestringNoneAdditional CSS classes for the container holding the chips.
labelstringNoneLabel text for the input field.
labelClassNamestringNoneAdditional CSS classes for the label text.
isLabelbooleanfalseSpecifies whether to show the label text.
placeholderstringNonePlaceholder text for the input field.
iconColorstringstring"#FFF"The color of the icon displayed next to the chip (if any).

Carousel

Props

NameTypeDefaultDescription
slidesSlideProps[]RequiredArray of slide objects, each with url and alt properties.
loopbooleanfalseEnables automatic looping through slides.

SlideProps

Props

NameTypeDescription
urlstringReact.ReactElementURL of the image or a React element to display.
altstringAlternative text for the image or React element.

Switch

Props

NameTypeDefaultDescription
size"normal", "large""normal".Specifies the size of the switch.
checkedbooleanfalseSpecifies whether the switch is on or off.
onToggle(checked: boolean) => voidNoneCallback function triggered when the switch is toggled.
accentColorstring"#4F46E5"Specifies the accent color of the switch when it is turned on.

Usage

import { Button, CardComponent, Checkbox, Input, ModalComponent, Seekbar,Otp,AccordionComponent,TextArea,SkeletonComponent,Select,ChipInput,Carousel } from 'quant-ui';
import "quant-ui-react/dist/styles.css"

const { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } = CardComponent
const { Accordion, AccordionItem, AccordionTrigger } = AccordionComponent

const { ModalButton, ModalContent } = ModalComponent

const { SkeletonDiv, SkeletonImage } = SkeletonComponent

// Example usage of Button component
<Button variant="default" variantSize="lg" onClick={handleClick}>Click me</Button>

// Example usage of Card component
 <Card>
    <CardHeader>
      <CardTitle>This is a Card Title</CardTitle>
      <CardDescription>This is a description of the card.</CardDescription>
    </CardHeader>
    <CardContent>
      <p>This is the main content of the card.</p>
    </CardContent>
    <CardFooter>
      <p>Footer content goes here.</p>
    </CardFooter>
  </Card>

// Example usage of Checkbox component
<Checkbox isLabel label='Label Name' labelClassName='tailwind-class' />

// Example usage of Input component
<Input label="Username" type="text" />

// Example usage of Modal component
<Modal isOpen={isOpen} onClose={handleClose}>
 <ModalButton onOpen={openModal}>Open Modal</ModalButton>
  <ModalContent>{modalContent}</ModalContent>
</Modal>

// Example usage of Seekbar component
<Seekbar value={seekbarValue} max={100} min={0} />

// Example usage of Otp component
<Otp onOtpChange={handleOtpChange} ref={otpRef} elements={6} variant="md" />

// Example usage of Avatar component
<Avatar src="Image.png" alt="Profile picture" variantSize="md" />

// Example usage of Badge component
<Badge variant="default">Default</Badge>

// Example usage of Toast component
<>
  <Toast position="top-right" duration={3000} reverseOrder={false} gutter={8} />

    <ToastTrigger
      cta="This is a success toast!"
      typeOfToast="success"
    >
      Show Success Toast
    </ToastTrigger>

    <ToastTrigger
      cta="This is an error toast!"
      typeOfToast="error"
    >
      Show Error Toast
    </ToastTrigger>

    <ToastTrigger
      cta="Promise toast example"
      typeOfToast="promise"
      promiseLoadingText="Saving..."
      promiseLoadingSuccess="Settings saved!"
      promiseLoadingError="Could not save."
      promiseFn={mockApiCall}
    >
      Show Promise Toast
    </ToastTrigger>
<>

// Example usage of Spinner component
<>
  <SpinnerLoader size={45} color='#000' />
  <BarLoader size={45} />
  <DotLoader size={30} />
</>
<Radio variantSize='md' isLabel label='CTA' labelClassName='tailwind-class' accentColor='hex-code'  />

// Example usage of Accordion component
<>
  <Accordion className="tailwind-class">
    <AccordionTrigger
      variant='variant'
      iconColor='color'
      title={title}
      isOpen={isOpen}
      onOpen={onOpen}
      className="tailwind-class"
    />
    <AccordionItem
      isOpen={isOpen}
      content={content}
      className="tailwind-class"
    />
  </Accordion>

</>

// Example usage of Skeleton component
<>
  <SkeletonImage className='tailwind-class' />
  <SkeletonDiv className='tailwind-class' />
</>

// Example usage of TextArea component
<TextArea className='tailwind-class' />

// Example usage of Select component
<Select
  options={options}
  value={selectedOption}
  onChange={handleChange}
  label="Select a option"
  placeholder="Choose an option"
  className="tailwind-class"
  labelClassName="tailwind-class"
/>

// Example usage of ChipInput component
<ChipInput
  chips={chips}
  onChipsChange={setChips}
  className='tailwind-class'
  placeholder="Type and press Enter"
  isLabel
  label="Tags"
  inputClassName="tailwind-class"
  chipClassName="tailwind-class"
  chipContainerClassName="tailwind-class"
  iconColor={"red"}
/>

// Example usage of Carousel component
<Carousel loop slides={image_Array} className="taiwind-css" />
1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago