2.1.8 • Published 3 months ago

@mohamedhemidi/vault-ui v2.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Vault UI

Table of Contents

  1. Installation
  2. Buttons components
  3. Input text components
  4. Select components
  5. Lazy Load Image Component
  6. Toast Component
  7. API references and Usage

Installation

 npm install @mohamedhemidi/vault-ui

Buttons components

Simple buttons

<Button color="primary">Primary Button</Button>
<Button color="success">Success Button</Button>

When using Icons it's highly recommended to use Google svg icons as they support re-coloring with fill attribute.

 <Button
    icon={<EditIcon />}
    variant="outlined"
    size="small"
    color="primary"> Primary Outlined Button with Icon</Button>

image

Input text components

Simple input texts

<TextField label="Email" color="primary" type="text" name="username" />
<TextArea
    label="Summary"
    color="success"
    name="summary"
/>

Input with Error :

<TextField
    label="Username"
    error
    errorMessage="Username is already taken, try another"
    color="primary"
    type="text"
    name="username"
/>
<TextArea
          label="Description"
          color="success"
          name="description"
          error
          errorMessage="Please write a description"
/>

image

image

Select components

image

Example of usage:

const options = [
  { label: "First", value: 1 },
  { label: "Second", value: 2 },
  { label: "Third", value: 3 },
  { label: "Fourth", value: 4 },
  { label: "Fifth", value: 5 },
];
function App() {
    const [value1, setValue1] = useState<SelectOption[]>([options[0]]);
    const [value2, setValue2] = useState<SelectOption | undefined>(options[0]);
    
    return (
         <Select
          multiple
          options={options}
          value={value1}
          onChange={(o) => setValue1(o)}
        />
        
        <Select
          options={options}
          value={value2}
          onChange={(o) => setValue2(o)}
        />
    )
}

Lazy Load Image Component

image

Example of usage:

<LazyLoadImage 
src={'your_image_path'} alt='alt text' borderRadius="2rem" />

Toast Component

image

A light and responsive notifications toasts component:

const [active, setsActive] = useState(false);

<Toast
    message="You signed up successfully" // Toast message
    timer={6} // 6 seconds to close
    active={active} // 
    close={() => setsActive(false)}
/>

API References and Usage

API references doc for the button component and usage

  | Name | Type | Default | Description | |----------|-----------------------------------------------------------------------------------|---------|----------------------------------------------------------------------------------------------------------| | children | node | - | The content of the button | | color | |"primary" |"secondary" |"info" |"warning" |"danger" |"success" |"neutral" | primary | The background color of the button | | size | |"small" |"medium" |"large" | small | The size of the button | | variant | |"outlined" |"ghost" |"filled" |"shadow" | filled | The variant shape to use | | rounded | boolean | false | If true the button will be rounded ⚠️ If true, the button accepts only icons and No text or children | | disabled | boolean | false | If true button will be disabled | | loading | boolean | false | If true a loading spinner shows and button will be disabled | | icon | node | - | svg element placed at the beginning of the button , ⚠️ Google icons are recomended | | width | number | auto | Width size in rem unit | | height | number | auto | Height size in rem unit |

API References for Text Field component

 

NameTypeDefaultDescription
color|"primary" |"secondary" |"info" |"warning" |"danger" |"success" |"neutral"primaryThe color of the input outline
labeltext-The label text of the input
placeholdertext-The placeholder text of the input
errorbooleanfalseIf true the borders and label get a red color
errorMessagetext-The error message in case of validation error
disabledbooleanfalseIf true button will be disabled
widthnumberautoWidth size in rem unit

API References for Text Area component

 

NameTypeDefaultDescription
color|"primary" |"secondary" |"info" |"warning" |"danger" |"success" |"neutral"primaryThe color of the input outline
labeltext-The label text of the input
placeholdertext-The placeholder text of the input
errorbooleanfalseIf true the borders and label get a red color
errorMessagetext-The error message in case of validation error
disabledbooleanfalseIf true button will be disabled
widthnumberautoWidth size in rem unit

API References for Select component

 

NameTypeDefaultDescription
multiplebooleanfalseIf true the select accept multi selection and
options*array-An array of key value objects, ex : {label: "Item 1", value: "items-one"}
value*array-An array of key value Object , usually set in component state.

API References for Lazy Load Image component

 

NameTypeDefaultDescription
srcstring-The path to the image
altstring-Alt text for SEO
fallbackImagestring-The path for the small size bitmap image that displays while loading, an auto base64 image is generated if this not provided
borderRadiusstring0The radius of the image in string with unit eg: "3rem" , "15px"
2.1.8

3 months ago

2.1.7

3 months ago

2.1.4

3 months ago

2.1.6

3 months ago

2.1.5

3 months ago

2.0.4

4 months ago

2.0.3

4 months ago

2.0.2

5 months ago

2.0.1

5 months ago

2.0.0

5 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.0

5 months ago