### Install project dependencies
Source: https://github.com/caioedut/react-bulk/blob/main/examples/expo/README.md
Run this command in the project root to install all required packages.
```bash
npm install
```
--------------------------------
### InputPin Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/input-pin.md
Provides various examples of InputPin configurations, including basic usage, different input types, and custom lengths.
```APIDOC
## InputPin Examples
### Basic Usage
```jsx
```
### Input Types
Demonstrates different `type` prop values for InputPin.
```jsx
```
### Custom Length
Sets a custom length for the pin input.
```jsx
```
```
--------------------------------
### InputDate Theming Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/input-date.md
Example of how to theme the InputDate component by defining default props and styles within the theme configuration.
```jsx
const theme = {
components: {
InputDate: {
defaultProps: {
/* ...props */
},
defaultStyles: {
root: { /* ...styles */ },
}
}
}
}
```
--------------------------------
### Start the development server
Source: https://github.com/caioedut/react-bulk/blob/main/examples/expo/README.md
Launches the Expo development server to run the application.
```bash
npx expo start
```
--------------------------------
### Basic Dropdown Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/overlays/dropdown.md
A simple example demonstrating how to open and close a Dropdown. Ensure the Dropdown is closed via the `onClose` prop.
```jsx
function Home() {
const [visible, setVisible] = useState(false);
return (
<>
setVisible(false)}>
Dropdown is amazing!
>
);
}
```
--------------------------------
### Basic InputDate Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/input-date.md
A basic example of the InputDate component displaying the current date.
```jsx
```
--------------------------------
### Modal Theming Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/overlays/modal.md
Example of how to customize the Modal component's styles through theming. This allows for global style adjustments.
```jsx
const theme = {
components: {
Modal: {
defaultStyles: {
root: { /* ...styles */ },
backdrop: { /* ...styles */ },
}
}
}
}
```
--------------------------------
### Dropdown Placement and Positioning
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/overlays/dropdown.md
Examples demonstrating how to control the placement and position of the Dropdown.
```APIDOC
## Placement
You can use placements `top` and `bottom`. Default is `bottom`. Combine with `triggerRef` to position the `Dropdown` relative to the element.
```jsx
function Home() {
const topTriggerRef = useRef();
const [topVisible, setTopVisible] = useState(false);
const bottomTriggerRef = useRef();
const [bottomVisible, setBottomVisible] = useState(false);
return (
setBottomVisible(false)}>
Dropdown is amazing! setTopVisible(false)}>
Dropdown is amazing!
);
}
```
## Position
You can use styles `top`, `bottom`, `left` and `right` as you want.
```jsx
function Home() {
const triggerRef = useRef();
const [visible, setVisible] = useState(false);
return (
<>
setVisible(false)}>
Dropdown is amazing!
>
);
}
```
```
--------------------------------
### Checkbox Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/checkbox.md
Examples demonstrating the usage of the Checkbox component in various scenarios.
```APIDOC
## Checkbox Examples
### Basic Usage
```jsx live
<>
>
```
### Composition and States
```jsx live
```
```
--------------------------------
### Input Component Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/input.md
Demonstrates various ways to use the Input component, including basic configurations, different sizes, error handling, and addons.
```APIDOC
### Basic Examples
```jsx live
```
### Sizes
```jsx live
```
### Error State
```jsx live
```
### Addons
```jsx live
function Home () {
const CustomIcon = () => 👁
return (
} />
)
}
```
```
--------------------------------
### Image Component Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/image.md
Illustrates various ways to use the Image component with different props.
```APIDOC
## Image Component Examples
### Sizes
```jsx
```
### Border Radius
```jsx
```
```
--------------------------------
### Splitter Theming Configuration
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/splitter.md
Example of how to configure default props and styles for the Splitter component within the theme.
```javascript
const theme = {
components: {
Splitter: {
defaultProps: {
direction: 'horizontal',
/* ...props */
},
defaultStyles: {
root: { /* ...styles */ },
item: { /* ...styles */ }
}
}
}
}
```
--------------------------------
### Install React Bulk Packages
Source: https://context7.com/caioedut/react-bulk/llms.txt
Install the necessary React Bulk packages based on your target platform (React Web, React Native CLI, or Expo).
```bash
# React Web (DOM)
yarn add react-dom @react-bulk/core @react-bulk/web
# React Native (CLI)
yarn add react-native-svg @react-bulk/core @react-bulk/native
# Expo (Native + optional Web)
npx expo install react-native-svg
yarn add @react-bulk/core @react-bulk/expo
```
--------------------------------
### Basic List Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/list.md
Renders a basic virtual list with 100 items. Ensure `rowHeight` is set correctly for proper rendering.
```jsx
{Array.from({ length: 100 }).map((_, index) => (
Item Child {index + 1}
))}
```
--------------------------------
### Basic Box Styling Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/core/box.md
Demonstrates basic styling of Box components using properties like border, padding, margin, background color, and height.
```jsx
Styled BoxStyled BoxStyled BoxStyled BoxStyled Box
```
--------------------------------
### Open Toast with Options
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/hooks/use-toaster.md
Illustrates opening a toast notification using the `open` method with custom options. This example shows how to pass an object to configure the toast's content and behavior.
```javascript
toaster.open(options)
```
--------------------------------
### Drawer Component Examples
Source: https://context7.com/caioedut/react-bulk/llms.txt
Shows how to implement drawers on the right and left sides of the screen. Customize placement and maximum width using props. Ensure necessary imports.
```jsx
import { Drawer, Card, Button, Text, Divider, Box } from '@react-bulk/web'; // OR @react-bulk/native
import { useState } from 'react';
function DrawerExample() {
const [rightVisible, setRightVisible] = useState(false);
const [leftVisible, setLeftVisible] = useState(false);
return (
{/* Right drawer (default) */}
setRightVisible(false)}
placement="right"
maxw={320}
>
Menu
{/* Left drawer */}
setLeftVisible(false)}
placement="left"
maxw={280}
>
NavigationLeft side navigation drawer
);
}
```
--------------------------------
### Form Component Usage
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/form.md
Demonstrates how to import and use the Form component with basic examples of submission and cancellation.
```APIDOC
## Import
```jsx
import { Form } from '@react-bulk/web'; // OR @react-bulk/native
```
## Examples
### Basic
```jsx live
function Home() {
function handleSubmit(event, data) {
alert(`Your name is "${data.name || ''}"`);
}
function handleCancel(event, data) {
alert('Cancelled!');
}
return (
);
}
```
```
--------------------------------
### Implement Select Component
Source: https://context7.com/caioedut/react-bulk/llms.txt
Provides examples for single and multiple selection, colorful styling, error states, addons, and disabled options.
```jsx
import { Select, Box } from '@react-bulk/web'; // OR @react-bulk/native
function SelectExample() {
return (
{/* Basic select */}
{/* Colorful style */}
{/* With error */}
{/* With addon */}
{/* Multiple selection */}
{/* With dividers between options */}
{/* Disabled option */}
);
}
```
--------------------------------
### Basic Form Usage
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/form.md
A basic example demonstrating how to set up a form with submit and cancel handlers, and includes input fields and buttons for user interaction.
```jsx
function Home() {
function handleSubmit(event, data) {
alert(`Your name is "${data.name || ''}"`);
}
function handleCancel(event, data) {
alert('Cancelled!');
}
return (
);
}
```
--------------------------------
### Box Positioning and Spacing Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/core/box.md
Shows how to apply spacing and positioning styles using shorthand properties like `i`, `m`, `p`, `t`, `b`, `l`, `r`, `y`, `x`, `v`, `h`.
```jsx
// inset: theme.shape.spacing * 2
// top: theme.shape.spacing * 2
// margin: theme.shape.spacing * 2
// marginLeft: theme.shape.spacing * 2
// marginRight: '5%'
// padding: theme.typography.fontSize * 2 (also works on native)
// paddingRight: '16px'
// paddingVertical: '16px' (on web, sets paddingTop and paddingBottom)
// paddingHorizontal: '16px' (on web, sets paddingLeft and paddingRight)
```
--------------------------------
### Install React Bulk for React Web
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/getting-started/installation.md
Use this command for standard React DOM projects. Requires react and react-dom version 17.0.0 or higher.
```bash
yarn add react-dom @react-bulk/core @react-bulk/web
```
--------------------------------
### Box Gap Examples (Raw)
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/core/box.md
Demonstrates setting direct pixel or rem values for `gap`, `rowGap`, and `columnGap` properties on the Box component.
```jsx
// gap value is 16px
// gap value is 16px
// gap value is 2rem (= 32px with default theme)
```
--------------------------------
### Install React Bulk for Expo
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/getting-started/installation.md
Use these commands for Expo projects. Requires expo 52.0.0+ and react-native-svg.
```bash
npx expo install react-native-svg
yarn add @react-bulk/core @react-bulk/expo
```
--------------------------------
### Basic Badge Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/data-display/badge.md
Demonstrates various basic usages of the Badge component, including dot indicators, numerical values, text content, and custom colors.
```jsx
2primarycustom
```
--------------------------------
### Animate Components with useAnimation
Source: https://context7.com/caioedut/react-bulk/llms.txt
Shows how to control animations using start, stop, and reset methods, and how to apply animation properties to components.
```jsx
import { useAnimation, Box, Button, Grid } from '@react-bulk/web'; // OR @react-bulk/native
function UseAnimationExample() {
const from = { width: 50, height: 50, opacity: 0.5 };
const to = { width: 200, height: 100, opacity: 1 };
const sizeAnim = useAnimation(from);
return (
{/* Animation controls */}
{/* Animated element - spread animation props */}
Animated
);
}
```
--------------------------------
### Dropdown Placement Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/overlays/dropdown.md
Demonstrates positioning the Dropdown above or below a trigger element using the `placement` prop and `triggerRef`. The default placement is 'bottom'.
```jsx
function Home() {
const topTriggerRef = useRef();
const [topVisible, setTopVisible] = useState(false);
const bottomTriggerRef = useRef();
const [bottomVisible, setBottomVisible] = useState(false);
return (
setBottomVisible(false)}>
Dropdown is amazing! setTopVisible(false)}>
Dropdown is amazing!
);
}
```
--------------------------------
### Basic Image Display
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/image.md
A basic example of displaying an image using the Image component with a source URL.
```jsx
```
--------------------------------
### Basic Modal Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/overlays/modal.md
A simple modal that opens and closes with a button click. The 'visible' prop controls its display state.
```jsx
function Home() {
const [visible, setVisible] = useState(false);
return (
<>
Modal is amazing!
>
);
}
```
--------------------------------
### Badge Composition Examples
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/data-display/badge.md
Shows how the Badge component can be composed with other elements, such as positioning it relative to a container or attaching it to a Button.
```jsx
2
```
--------------------------------
### Pressed Style Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/core/box.md
Applies styles to pressable components when they are actively being pressed. Defaults to reduced opacity.
```javascript
{ opacity: 0.7 }
```
--------------------------------
### Resizable Component API
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/resizable.md
Documentation for the Resizable component, including its import statement, available props, and usage examples.
```APIDOC
## Resizable Component
Used to create resizable containers.
### Import
```jsx
import { Resizable } from '@react-bulk/web'; // OR @react-bulk/native
```
### Examples
#### Basic Resizable Container
```jsx
```
#### Vertical Resizable Container
```jsx
```
#### Horizontal Resizable Container
```jsx
```
### Props
Extends all [`Box`](/docs/core/box#props) props.
#### `horizontal`
➤ Type: `boolean`
Controls horizontal resizing.
#### `vertical`
➤ Type: `boolean`
Controls vertical resizing.
### Styles
#### `style`
To the main element.
```
--------------------------------
### Basic Grid Layout
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/layout/grid.md
A basic example of using the Grid component to arrange two Box components side-by-side.
```jsx
Hello World!Welcome!
```
--------------------------------
### Basic Splitter Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/splitter.md
A basic horizontal splitter with two panels. The left panel has a fixed width and background, while the right panel takes up the remaining space.
```jsx
SidebarContent
```
--------------------------------
### Install React Bulk for React Native CLI
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/getting-started/installation.md
Use this command for React Native CLI projects. Requires react 17.0.0+, react-native 0.71.0+, and react-native-svg.
```bash
yarn add react-native-svg @react-bulk/core @react-bulk/native
```
--------------------------------
### Text Component Examples
Source: https://context7.com/caioedut/react-bulk/llms.txt
Illustrates the usage of the Text component for displaying and styling text, including basic styling, color options, heading variants, size multipliers, alignment, text transformation, and line limiting.
```jsx
import { Text } from '@react-bulk/web'; // OR @react-bulk/native
function TextExample() {
return (
{/* Basic text with styling */}
Bold TextItalic TextPrimary ColorSecondary Text ColorHex Color
{/* Heading variants */}
Heading 1Heading 2Heading 3TitleSubtitleCaption
{/* Size multiplier (multiplied by theme.typography.fontSize) */}
Default SizeDouble Size1.5x Size
{/* Text alignment and transform */}
Centered TextRight AlignedUppercase Text
{/* Line limiting */}
This is a very long text that will be truncated after two lines...
);
}
```
--------------------------------
### Basic Animation Control with useAnimation
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/hooks/use-animation.md
Demonstrates how to use the useAnimation hook to control element animations. Use the start method with 'from' and 'to' properties to define animation keyframes. The hook's props are applied to the target element.
```jsx
function App() {
const from = { width: 40, height: 40 };
const to = { width: 200, height: 200 };
const sizeAnim = useAnimation(from);
return (
);
}
```
--------------------------------
### Vertical Splitter Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/splitter.md
A vertical splitter with a fixed height. The top panel has a fixed height, and the bottom panel expands to fill the remaining space.
```jsx
TopBottom
```
--------------------------------
### Box Component Examples
Source: https://context7.com/caioedut/react-bulk/llms.txt
Demonstrates various uses of the Box component for layout and styling, including basic styling, centering, background colors, fixed height, custom borders, flexbox layouts, and platform-specific props.
```jsx
import { Box } from '@react-bulk/web'; // OR @react-bulk/native
function BoxExample() {
return (
{/* Basic styled box with border and padding */}
Styled Box
{/* Centered with auto margin */}
Centered Box
{/* Background color using theme token */}
Primary Color Background
{/* Fixed height */}
Fixed Height Box
{/* Custom border and rounded corners */}
Custom Border
{/* Flexbox row layout with gap */}
Item 1Item 2
{/* Using custom component */}
Link as Box
{/* Platform-specific props */}
);
}
```
--------------------------------
### Composed Modal Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/overlays/modal.md
Demonstrates a composed modal with a title, text, and buttons. The 'onClose' prop is used to manage the modal's visibility.
```jsx
function Home() {
const [visible, setVisible] = useState(false);
return (
<>
setVisible(false)}>
React Bulk
Complete and uniform UI for React Web and Native
>
);
}
```
--------------------------------
### Accessibility Props Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/core/box.md
Defines accessibility properties for components, including roles, states, and values. Ensure these are configured for better screen reader support.
```javascript
{
accessible: boolean
hint: string
label: string
role: 'none' | 'button' | 'link'
| 'search' | 'image' | 'alert'
| 'checkbox' | 'combobox' | 'menu'
| 'menubar' | 'menuitem' | 'progressbar'
| 'radio' | 'radiogroup' | 'scrollbar'
| 'spinbutton' | 'switch' | 'tab'
| 'tablist' | 'timer' | 'toolbar'
state: {
busy: boolean
checked: boolean
disabled: boolean
expanded: boolean
selected: boolean
}
value: {
max: number
min: number
now: number
text: string
}
}
```
--------------------------------
### Reset project structure
Source: https://github.com/caioedut/react-bulk/blob/main/examples/expo/README.md
Moves existing starter code to app-example and initializes a blank app directory.
```bash
npm run reset-project
```
--------------------------------
### Select Addons
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/select.md
Shows how to add a prefix icon or text using the startAddon prop.
```jsx
```
--------------------------------
### Dropdown Custom Positioning Example
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/overlays/dropdown.md
Allows custom positioning of the Dropdown using styles like `top`, `bottom`, `left`, and `right` in conjunction with `triggerRef`. This example positions the dropdown to the right.
```jsx
function Home() {
const triggerRef = useRef();
const [visible, setVisible] = useState(false);
return (
<>
setVisible(false)}>
Dropdown is amazing!
>
);
}
```
--------------------------------
### Grid Breakpoints Configuration
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/layout/grid.md
Example of overriding default layout breakpoints for a specific Grid component.
```js
{
xs?: number;
sm?: number;
md?: number;
lg?: number;
xl?: number;
xxl?: number;
}
```
--------------------------------
### Button Group API
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/button-group.md
Documentation for the Button Group component, including its props and usage examples.
```APIDOC
## Button Group Component
Used to group multiple buttons into a single scrollable container.
### Import
```jsx
import { ButtonGroup } from '@react-bulk/web'; // OR @react-bulk/native
```
### Props
#### `color`
➤ Type: `string` [`RbkColor`](/docs/type-reference/rbk-color)
➤ Default: `primary`
---
#### `disabled`
➤ Type: `boolean`
---
#### `size`
➤ Type: `'small'` `'medium'` `'large'` `'xlarge'`
➤ Default: `medium`
---
#### `variant`
➤ Type: `'solid'` `'outline'` `'text'`
➤ Default: `solid`
---
### Styles
#### `style`
To the outer wrapper element ([Scrollable](/docs/core/scrollable)).
#### `contentStyle`
To the inner wrapper.
### Examples
#### Basic Usage
```jsx
```
#### Variants
```jsx
```
#### Sizes
```jsx
```
```
--------------------------------
### Import Form Component
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/forms/form.md
Import the Form component from either '@react-bulk/web' or '@react-bulk/native' depending on your project setup.
```jsx
import { Form } from '@react-bulk/web'; // OR @react-bulk/native
```
--------------------------------
### Theme Configuration for Scrollable
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/core/scrollable.md
Example of how to override default props and styles for the Scrollable component within the theme object.
```jsx
const theme = {
components: {
Scrollable: {
defaultProps: {
/* ...props */
},
defaultStyles: {
root: { /* ...styles */ },
content: { /* ...styles */ },
stickyHeader: { /* ...styles */ },
}
}
}
}
```
--------------------------------
### Initialize ReactBulk Theme
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/layout/theme.md
Wrap the application with the ReactBulk provider and pass the custom theme object.
```jsx
import { ReactBulk } from '@react-bulk/web'; // OR @react-bulk/native
import theme from './src/themes/main.js'
export default function App() {
return (
{/* other like contexts and routes */}
);
}
```
--------------------------------
### Basic and Confirmation Modals
Source: https://context7.com/caioedut/react-bulk/llms.txt
Demonstrates how to implement a basic modal for general content and a confirmation modal for user actions. Ensure the necessary components are imported from '@react-bulk/web' or '@react-bulk/native'.
```jsx
import { Modal, Button, Text, Divider, Box } from '@react-bulk/web'; // OR @react-bulk/native
import { useState } from 'react';
function ModalExample() {
const [visible, setVisible] = useState(false);
const [confirmVisible, setConfirmVisible] = useState(false);
return (
{/* Basic modal */}
setVisible(false)}>
Modal Title
This is the modal content. You can put any components here.
{/* Confirmation modal */}
setConfirmVisible(false)}
halign="center"
valign="center"
>
Confirm DeleteAre you sure you want to delete this item?
);
}
```
--------------------------------
### Tabs Variants
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/tabs.md
Examples of different tab styles including group, card, and nav variants using controlled state.
```jsx
function App() {
const [tab, setTab] = useState(0);
return (
setTab(newValue)}
tabs={[
{ label: 'Tab 1' },
{ label: 'Tab 2' },
{ label: 'Tab 3' },
]}
/>
)
}
```
```jsx
function App() {
const [tab, setTab] = useState(0);
return (
setTab(newValue)}
tabs={[
{ label: 'Tab 1' },
{ label: 'Tab 2' },
{ label: 'Tab 3' },
]}
/>
)
}
```
```jsx
function App() {
const [tab, setTab] = useState(0);
return (
setTab(newValue)}
tabs={[
{ label: 'Tab 1' },
{ label: 'Tab 2' },
{ label: 'Tab 3' },
]}
/>
)
}
```
--------------------------------
### Implement Input Component
Source: https://context7.com/caioedut/react-bulk/llms.txt
Demonstrates various Input configurations including validation, masks, addons, and controlled states.
```jsx
import { Input, Box, Form, Button } from '@react-bulk/web'; // OR @react-bulk/native
import { useState } from 'react';
function InputExample() {
const [value, setValue] = useState('');
return (
{/* Basic input */}
{/* With label */}
{/* Colorful style */}
{/* Password/secure input */}
{/* Input sizes */}
{/* With error message */}
{/* With addons */}
{/* Input types */}
{/* Multiline (textarea) */}
{/* Controlled input */}
setValue(e.value)}
placeholder="Controlled input"
/>
{/* Read-only and disabled states */}
{/* With mask function */}
val.replace(/\D/g, '').replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3')}
/>
);
}
```
--------------------------------
### Image Component Usage
Source: https://github.com/caioedut/react-bulk/blob/main/docs/docs/content/image.md
Demonstrates how to import and use the Image component.
```APIDOC
## Image Component Usage
### Description
This section shows how to import and use the Image component from the @react-bulk library.
### Import
```jsx
import { Image } from '@react-bulk/web'; // OR @react-bulk/native
```
### Basic Example
```jsx
```
```