1.0.78 • Published 12 days ago

@hoddy-ui/core v1.0.78

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days 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.77

12 days ago

1.0.78

12 days ago

1.0.76

14 days ago

1.0.75

1 month ago

1.0.74

2 months ago

1.0.73

2 months ago

1.0.72

2 months ago

1.0.71

3 months ago

1.0.70

3 months ago

1.0.69

3 months ago

1.0.68

3 months ago

1.0.66

3 months ago

1.0.65

3 months ago

1.0.67

3 months ago

1.0.64

4 months ago

1.0.63

4 months ago

1.0.62

4 months ago

1.0.60

4 months ago

1.0.29

8 months ago

1.0.28

8 months ago

1.0.27

8 months ago

1.0.33

8 months ago

1.0.32

8 months ago

1.0.31

8 months ago

1.0.30

8 months ago

1.0.37

8 months ago

1.0.36

8 months ago

1.0.35

8 months ago

1.0.34

8 months ago

1.0.39

7 months ago

1.0.38

8 months ago

1.0.40

7 months ago

1.0.44

7 months ago

1.0.43

7 months ago

1.0.42

7 months ago

1.0.41

7 months ago

1.0.48

7 months ago

1.0.47

7 months ago

1.0.46

7 months ago

1.0.45

7 months ago

1.0.49

7 months ago

1.0.51

7 months ago

1.0.50

7 months ago

1.0.55

7 months ago

1.0.54

7 months ago

1.0.53

7 months ago

1.0.52

7 months ago

1.0.59

6 months ago

1.0.58

6 months ago

1.0.57

6 months ago

1.0.56

7 months ago

1.0.26

11 months ago

1.0.25

11 months ago

1.0.24

12 months ago

1.0.23

12 months ago

1.0.22

12 months ago

1.0.21

12 months ago

1.0.20

12 months ago

1.0.19

12 months ago

1.0.18

12 months ago

1.0.17

12 months ago

1.0.16

12 months ago

1.0.15

12 months ago

1.0.14

12 months ago

1.0.13

12 months ago

1.0.12

12 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago