1.0.88 • Published 9 months ago

@hoddy-ui/core v1.0.88

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

@hoddy-ui/core

Hoddy UI is a versatile UI component and theming library for React Native and Expo. It follows the Hoddy UI design guidelines, which are a tweak of Material Design. The library provides a collection of reusable components and a customizable theming system to simplify and accelerate the development of mobile applications.

Installation

To install Hoddy UI, use npm or yarn:

npm:

npm install @hoddy-ui/core

yarn:

yarn add @hoddy-ui/core

Hoddy UI has the following peer dependencies, make sure to install them as well:

"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "^1.18.1",
"@react-navigation/native": "^6.1.6",
"expo-navigation-bar": "^2.1.1",
"expo-system-ui": "^2.2.1",
"react": "^18.2.0",
"react-native": "^0.71.8",
"react-native-safe-area-context": "^4.5.3",
"react-native-size-matters": "^0.4.0"

Enabling dark mode

To take advantage of the dark mode feature, add the UIProvider component to the root of your app

import { UIThemeProvider } from "hoddy-ui/core";

function App() {
  return (
    <UIThemeProvider>
      <Component />
    </UIThemeProvider>
  );
}

Usage

Here's a quick example of how to use Hoddy UI in your React Native or Expo project:

import React from "react";
import { View } from "react-native";
import { Button, Typography } from "@hoddy-ui/core";

const HomeScreen = () => {
  return (
    <View>
      <Typography>Welcome to Hoddy UI!</Typography>
      <Button title="Click me" onPress={() => console.log("Button pressed!")} />
    </View>
  );
};

export default HomeScreen;

Components

Hoddy UI provides the following components for building your UI:

Component API Reference

AdaptiveStatusBar

A component that adapts the status bar color based on the theme.

Props:

PropTypeDefaultDescription
barStylestring"light-content"The style of the status bar. Possible values: "default", "light-content", "dark-content".
backgroundColorstringTheme-dependentThe background color of the status bar.

Example usage:

import { AdaptiveStatusBar } from "@hoddy-ui/core";

const App = () => {
  return (
    <>
      <AdaptiveStatusBar />
      {/* Rest of the app */}
    </>
  );
};

Avatar

A component for displaying user avatars.

Props:

PropTypeDefaultDescription
imagenumber-The source of the avatar image.
sizenumber40The size of the avatar in pixels.
roundedbooleanfalseWhether the avatar should be rounded.

AlertX

A customizable alert component.

Props:

PropTypeDefaultDescription
titlestring-The title of the alert.
messagestring-The message/content of the alert.
typestring"default"The type of the alert. Possible values: "default", "success", "error", "warning".

Button

A customizable button component.

Props:

PropTypeDefaultDescription
titlestring-The text to display on the button.
onPressfunction-The function to be called on button press.

FlashMessage

A component for displaying flash messages.

Props:

PropTypeDefaultDescription
messagestring-The message/content of the flash message.
typestring"default"The type of the flash message. Possible values: "default", "success", "error", "warning".
durationnumber3000The duration in milliseconds that the flash message should be displayed.
autoHidebooleantrueWhether the flash message should auto-hide after the specified duration.

FormWrapper

A wrapper component for form fields.

Props:

PropTypeDefaultDescription
childrennode-The form fields/components to be wrapped.

Grid

A flexible grid component for arranging child elements.

Props:

PropTypeDefaultDescription
childrennode-The child elements to be rendered in the grid.
numColumnsnumber2The number of columns in the grid.
spacingnumber10The spacing between grid items in pixels.

GridItem

A component representing an item in the Grid component.

Props:

PropTypeDefaultDescription
childrennode-The content of the grid item.

IconButton

A button component with an icon.

Props:

PropTypeDefaultDescription
iconstring-The name of the icon to display.
onPressfunction-The function to be called on button press.

LinkButton

A button component that navigates to a specified URL.

Props:

PropTypeDefaultDescription
titlestring-The text to display on the button.
urlstring-The URL to navigate to on button press.

List

A component for rendering lists.

Props:

PropTypeDefaultDescription
childrennode-The list items to be rendered.

ListItem

A component representing an item in the List component.

Props:

PropTypeDefaultDescription
childrennode-The content of the list item.

ListItemText

A component representing the text content of a ListItem.

Props:

PropTypeDefaultDescription
childrennode-The text to be rendered.

Locator

A component for displaying a location marker on a map.

Props:

PropTypeDefaultDescription
latitudenumber-The latitude of the location.
longitudenumber-The longitude of the location.

Popup

A customizable popup component.

Props:

PropTypeDefaultDescription
titlestring-The title of the popup.
onClosefunction-The function to be called when the popup is closed.

SafeAreaView

A component that renders content within the safe area boundaries of the device.

Props:

PropTypeDefaultDescription
childrennode-The content to be rendered.

Spinner

A component for displaying a loading spinner.

Props:

PropTypeDefaultDescription
sizestring"small"The size of the spinner. Possible values: "small", "large".
colorstringTheme-dependentThe color of the spinner.

TextField

A component for text input.

Props:

PropTypeDefaultDescription
labelstring-The label for the text input.
placeholderstring-The placeholder text for the input.

TextField2

Another component for text input.

Props:

PropTypeDefaultDescription
labelstring-The label for the text input.
placeholderstring-The placeholder text for the input.

Typography

A component for displaying text with different styles.

Props:

PropTypeDefaultDescription
variantstring"body"The style variant of the text. Possible values: "heading", "title", "subheading", "body", "caption".
childrennode-The text content to be rendered.
1.0.83

11 months ago

1.0.82

1 year ago

1.0.81

1 year ago

1.0.88

9 months ago

1.0.87

9 months ago

1.0.86

11 months ago

1.0.85

11 months ago

1.0.80

1 year ago

1.0.79

1 year ago

1.0.77

1 year ago

1.0.78

1 year ago

1.0.76

1 year ago

1.0.75

1 year ago

1.0.74

1 year ago

1.0.73

1 year ago

1.0.72

1 year ago

1.0.71

1 year ago

1.0.70

1 year ago

1.0.69

1 year ago

1.0.68

1 year ago

1.0.66

1 year ago

1.0.65

1 year ago

1.0.67

1 year ago

1.0.64

1 year ago

1.0.63

1 year ago

1.0.62

1 year ago

1.0.60

1 year ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.40

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.49

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.59

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago