1.0.38 • Published 8 months ago

@joshdoesthis/react-ui v1.0.38

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

React UI

A simple UI library for React apps.

Installation

Using npm:

$ npm i @joshdoesthis/react-ui

Using yarn:

$ yarn add @joshdoesthis/react-ui

Usage

Theme is required in the top-level of the app as it initialises tailwind and provides context to components.

import { Theme, Box, Text, Button } from '@joshdoesthis/react-ui'

const App = () => {
  const [count, setCount] = useState(0)

  const increment = () => {
    setCount(() => count + 1)
  }

  return (
    <Theme>
      <Box>
        <Text h1>React UI</Text>
        <Text p>A simple UI library for React apps.</Text>
        <Text p>Count: {count}</Text>
        <Button press={increment}>Click me!</Button>
      </Box>
    </Theme>
  )
}

Theme

PropTypeDescription
themeobjectThe theme of the app.

Box

PropTypeDescription
forwardRefobjectA ref to the underlying HTML element.
stylestringAny tailwind classes to apply to the Box.

Button

PropTypeDescription
forwardRefobjectA ref to the underlying HTML element.
namestringThe name of the button for accessibility purposes.
activebooleanWhether or not the Button is active. Defaults to false.
disabledbooleanWhether or not the Button is disabled. Defaults to false.
stylestringAny tailwind classes to apply to the Button.
pressfunctionA function to call when the Button is pressed.

Cassette

PropTypeDescription
defaultValuestringThe default value of the Cassette.
optionsarrayAn array of options to display in the Cassette.
changefunctionA function to call when the Cassette's value changes.
OptionComponentfunctionA component to render each option. Defaults to DefaultOptionComponent.

OptionComponent

PropTypeDescription
namestringThe name of the option.
valuestringThe value of the option.
activebooleanWhether or not the option is active. Defaults to false.
selectfunctionA function to call when the option is selected. References Cassette's change.

Drawer

PropTypeDescription
visiblebooleanWhether or not the Drawer is visible. Defaults to false.
closefunctionA function to call when the Drawer is closed.
stylestringAny tailwind classes to apply to the Drawer.
TopComponentfunctionA component to render at the top of the Drawer. Defaults to DefaultTopComponent.

TopComponent

PropTypeDescription
closefunctionA function to call when the Drawer is closed. References Drawer's close.

Input

PropTypeDescription
idstringThe id of the Input.
typestringThe type of the Input. Defaults to text.
namestringThe name of the Input.
defaultValuestringThe default value of the Input.
okbooleanWhether or not the Input is ok. Defaults to true.
stylestringAny tailwind classes to apply to the Input.
blurfunctionA function to call when the Input is blurred. References Input's change.
changefunctionA function to call when the Input's value changes.

Markdown

PropTypeDescription
childrenstringThe markdown to render.

Passcode

PropTypeDescription
okbooleanWhether or not the Passcode is ok. Defaults to true.
changefunctionA function to call when the Passcode's value changes.

Select

PropTypeDescription
defaultValuestringThe default value of the Select.
optionsarrayAn array of options to display in the Select.
OptionComponentfunctionA component to render each option. Defaults to DefaultOptionComponent.
changefunctionA function to call when the Select's value changes.

OptionComponent

PropTypeDescription
namestringThe name of the option.
valuestringThe value of the option.
activebooleanWhether or not the option is active. Defaults to false.
selectfunctionA function to call when the option is selected. References Select's change.

Text

PropTypeDescription
childrenstringThe text to render.
stylestringAny tailwind classes to apply to the text.
b, strong, i, em, mark, small, del, ins, sub, sup, span, q, blockquote, abbr, address, cite, bdo, ul, ol, li, h1, h2, h3, h4, h5, h6, p, br, prebooleanWhether or not to render the text as the corresponding HTML element. Defaults to span.

DateTime

PropTypeDescription
changefunctionA function to call when DateTime's value changes.

DarkMode

PropTypeDescription
defaultModeenumThe default mode of the DarkMode. Options are auto, light, dark. Defaults to auto.
SwitchComponentfunctionA component to render the Switch. Defaults to DefaultSwitchComponent.

SwitchComponent

PropTypeDescription
modeenumThe current mode of the DarkMode.
cyclefunctionA function to call when the mode is cycled.
1.0.19

10 months ago

1.0.18

10 months ago

1.0.17

10 months ago

1.0.38

8 months ago

1.0.16

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

11 months ago

1.0.22

10 months ago

1.0.21

10 months ago

1.0.20

10 months ago

1.0.26

10 months ago

1.0.25

10 months ago

1.0.24

10 months ago

1.0.23

10 months ago

1.0.29

10 months ago

1.0.28

10 months ago

1.0.27

10 months ago

1.0.33

9 months ago

1.0.11

10 months ago

1.0.32

9 months ago

1.0.10

10 months ago

1.0.31

10 months ago

1.0.30

10 months ago

1.0.37

8 months ago

1.0.15

10 months ago

1.0.36

8 months ago

1.0.14

10 months ago

1.0.35

9 months ago

1.0.13

10 months ago

1.0.34

9 months ago

1.0.12

10 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago