### Install Atomize and React Transition Group with Yarn
Source: https://atomizecode.com/react/setup
This command installs the core Atomize UI library and its peer dependency, `react-transition-group`, using the Yarn package manager. It should be executed in the root directory of your project's terminal to set up the necessary packages.
```Shell
yarn add atomize react-transition-group
```
--------------------------------
### Apply Global Style Reset in React with Atomize
Source: https://atomizecode.com/react/setup
This example demonstrates how to integrate Atomize's `StyleReset` component into your main React application component. Placing `StyleReset` within the root component ensures that default browser styles are consistently normalized across your entire application, providing a clean and predictable base for Atomize's styling.
```JavaScript
import React from 'react';
import { StyleReset } from 'atomize';
import App from './src/App';
export default function Main() {
return (
<>
>
);
}
```
--------------------------------
### Customize Theme and Apply Style Reset in React with Atomize
Source: https://atomizecode.com/react/setup
This snippet illustrates how to use Atomize's `ThemeProvider` component to define and apply a custom theme, such as custom colors, to your React application. It also includes `StyleReset` for consistent global styling. This approach allows for centralized theme management and easy customization of your UI components.
```JavaScript
import React from 'react';
import { ThemeProvider, StyleReset } from 'atomize';
import App from './src/App';
const theme = {
colors: {
primary: 'tomato',
accent: 'yellow',
},
};
export default function Main() {
return (
);
}
```
--------------------------------
### Basic Atomize Input Component Usage
Source: https://atomizecode.com/react/atoms
Shows a minimal example of how to import and use the `Input` component from Atomize UI, demonstrating a basic placeholder.
```JSX
import { Input } from "atomize";
const BasicInput = () => {
return (
);
}
```
--------------------------------
### Atomize Responsive Prop Usage Examples
Source: https://atomizecode.com/react/responsive
Provides practical examples of applying responsive styles in Atomize using prop arrays. Demonstrates how to set breakpoint-specific values for properties like padding (p) and border, including nested properties for specific sides (t for top, b for bottom). This showcases direct application within JSX.
```JSX
// Padding
p={{ xs: '1rem', md: '4rem' }}
// Padding Top
p={{ t: {xs: '1rem', md: '4rem' }}}
// border
border={{ xs: '1px solid', lg: '2px dashed' }}
// Border Top & Bottom
border={
t: { xs: '1px solid', lg: '2px dashed' }
b: { xs: '1px solid', lg: '2px dashed' }
}
```
--------------------------------
### Styling Atomize Buttons with Icons
Source: https://atomizecode.com/react/atoms
Demonstrates how to create styled buttons using Atomize UI, incorporating icons and applying various utility properties like height, width, background, hover background, border radius, and margin. The first button is a reconstructed example to ensure valid JSX.
```JSX
// Message Button
// Attachment Button
```
--------------------------------
### Managing Atomize Radiobox State in React
Source: https://atomizecode.com/react/atoms
Provides an example of how to manage the checked state of Atomize `Radiobox` components using React class components, demonstrating `onChange` handlers and conditional `checked` props. The snippet is truncated from the original source.
```JSX
import { Radiobox, Label, Div } from "atomize";
class ManagingRadioboxWithState extends React.Component {
constructor(props) {
super(props);
this.state = {
selectedCountValue: 1
};
this.toggleSelectedCount = this.toggleSelectedCount.bind(this);
}
toggleSelectedCount(value) {
this.setState({
selectedCountValue: value,
})
}
render() {
const { selectedCountValue} = this.state;
return (
<
```
--------------------------------
### Add Custom Shadows to Atomize Theme
Source: https://atomizecode.com/react/theme
This example illustrates how to extend the default shadow values available in Atomize UI by defining a new custom shadow within the theme object. The `ThemeProvider` is used to make this new shadow available, allowing components to reference it by its defined name.
```javascript
import {
ThemeProvider,
Div,
Row,
Col } from "atomize";
const theme = {
shadows: {
"new-shadow": "0 16px 24px -2px rgba(0, 0, 0, 0.08)"
}
};
ReactDOM.render(
New Shadow
,
mountNode
);
```
--------------------------------
### Implement Atomizecode Row and Col for Grid Layout in React
Source: https://atomizecode.com/react/grid
Illustrates the usage of `Row` and `Col` components from Atomizecode to create a responsive flexbox-based grid layout in a React application. This example shows a basic 12-column grid division with two columns of sizes 5 and 7, demonstrating content alignment within the grid.
```JavaScript
import { Row, Col, Div } from "atomize";
ReactDOM.render(
This is 5 of 12
This is 7 of 12
, mountNode
);
```
--------------------------------
### Customize Component Transitions in Atomize Theme
Source: https://atomizecode.com/react/theme
This example shows how to define a custom transition property within the Atomize UI theme and apply it to a component for animated effects. It includes a React class component that toggles a `transform` style with a custom `transition` value, demonstrating a basic animation.
```javascript
import { Div, Text, Tag, Row, Col, ThemeProvider } from "atomize";
const theme = {
transition: {
custom: "transform 0.8s linear"
}
};
class Transition extends React.Component {
constructor(props) {
super(props);
this.state = {
animate: false
};
this.toggleState = this.toggleState.bind(this);
}
componentDidMount() {
setInterval(this.toggleState, 1000);
}
toggleState() {
const { animate } = this.state;
this.setState({ animate: !animate });
}
render() {
const { animate } = this.state;
return(
);
}
}
ReactDOM.render(, mountNode);
```
--------------------------------
### Configure Custom Font Sizes in Atomize Theme
Source: https://atomizecode.com/react/theme
This example shows how to add a custom font size and its corresponding line height to the Atomize UI theme. By defining new entries within the `textSize.size` and `textSize.height` properties of the theme, you can introduce new text sizing options for `Text` components.
```javascript
import { Text, ThemeProvider } from "atomize";
const theme = {
textSize: {
size: {
customSize: "25px"
},
height: {
customSize: "34px"
}
}
};
ReactDOM.render(
Custom Text Size,
mountNode
);
```
--------------------------------
### Creating a Div Component with Atomize
Source: https://atomizecode.com/react/atoms
Illustrates how to import and use the Div component from the Atomize UI library, applying various styling props such as background color, display type, alignment, and padding to create a styled container.
```JavaScript
import { Div } from "atomize";
This is the div
```
--------------------------------
### Atomize Anchor Component API Documentation
Source: https://atomizecode.com/react/atoms
Comprehensive API documentation for the Atomize Anchor component, detailing all available properties, their types, and default values. This includes options for layout, background, and hover effects.
```APIDOC
Anchor Component Props:
p: string | object (default: -)
- Padding utility prop.
m: string | object (default: -)
- Margin utility prop.
d: string (default: -)
- Display utility prop.
order: number (default: -)
- Flex order utility prop.
bg: string (default: -)
- Background color utility prop.
hoverBg: string (default: -)
- Background color on hover utility prop.
```
--------------------------------
### Scroll to Target Element using AtomizeCode scrollTo
Source: https://atomizecode.com/react/functions
Demonstrates how to use the `scrollTo` function from AtomizeCode to scroll to a target element identified by its ID. This example shows a basic scroll without custom offset or duration.
```JavaScript
import { Button, scrollTo } from "atomize";
const YellowButton = () => {
return (
)
}
```
--------------------------------
### Atomize Image Component API Documentation
Source: https://atomizecode.com/react/atoms
Comprehensive API documentation for the Atomize Image component, detailing all available properties, their types, and default values. This includes layout, sizing, border, shadow, and positioning options.
```APIDOC
Image Component Props:
p: string | object (default: -)
- Padding utility prop.
m: string | object (default: -)
- Margin utility prop.
d: string (default: -)
- Display utility prop.
flexGrow: number (default: -)
- Flex grow utility prop.
order: number (default: -)
- Flex order utility prop.
rounded: string | number (default: -)
- Border radius utility prop.
h: string | number (default: -)
- Height utility prop.
maxH: string | number (default: -)
- Max height utility prop.
minH: string | number (default: -)
- Min height utility prop.
w: string | number (default: 100%)
- Width utility prop.
maxW: string | number (default: -)
- Max width utility prop.
minW: string | number (default: -)
- Min width utility prop.
border: string | number (default: -)
- Border utility prop.
borderColor: string (default: -)
- Border color utility prop.
hoverBorderColor: string (default: -)
- Border color on hover utility prop.
shadow: string | number (default: -)
- Shadow utility prop.
hoverShadow: string | number (default: -)
- Shadow on hover utility prop.
position: string (default: -)
- Position utility prop.
top: string | number (default: -)
- Top position utility prop.
left: string | number (default: -)
- Left position utility prop.
right: string | number (default: -)
- Right position utility prop.
bottom: string | number (default: -)
- Bottom position utility prop.
transform: string (default: -)
- Transform utility prop.
transition: string (default: -)
- Transition utility prop.
cursor: string (default: -)
- Cursor style utility prop.
```
--------------------------------
### Atomize Switch Component API Documentation
Source: https://atomizecode.com/react/atoms
Comprehensive API documentation for the Atomize Switch component, detailing all available properties, their types, and default values. This includes styling, state management, and behavioral options.
```APIDOC
Switch Component Props:
isLoading: boolean (default: false)
- Controls the loading state of the switch.
disabled: boolean (default: false)
- Disables the switch interaction.
activeColor: string (default: info700)
- Color of the switch when active.
inactiveColor: string (default: gray500)
- Color of the switch when inactive.
activeShadow: number (default: 4)
- Shadow applied to the switch when active.
inactiveShadow: number (default: 0)
- Shadow applied to the switch when inactive.
m: object (default: { r: "1rem" })
- Margin utility prop for spacing.
cursor: string (default: pointer)
- Cursor style when hovering over the switch.
```
--------------------------------
### Basic Dropdown Component Implementation in Atomize
Source: https://atomizecode.com/react/molecules
This JavaScript code demonstrates the basic usage of the Atomize Dropdown component. It shows how to define a menu list using `Div` and `Anchor` components and how to control the dropdown's visibility using React state and the `isOpen` and `onClick` props.
```JavaScript
import { Dropdown, Anchor } from "atomize";
const menuList = (
);
class BasicDropdown extends React.Component {
constructor(props) {
super(props);
this.state = {
showDropdown: false,
};
}
render() {
const { showDropdown } = this.state;
return (
this.setState({ showDropdown: !showDropdown })
}
menu={menuList}
>
Click me
);
}
}
export default BasicDropdown;
```
--------------------------------
### Display Atomize Icon Component
Source: https://atomizecode.com/react/atoms
Shows how to render an icon using the Atomize `Icon` component, specifying its name, color, and size for visual presentation.
```jsx
// Add Icon
import { Icon } from "atomize";
```
--------------------------------
### Applying Responsive Spacing and Sizing Props in Atomize
Source: https://atomizecode.com/react/spacing
This snippet demonstrates how to apply responsive padding, margin, height, and width using Atomize Design System's utility props. It utilizes an 8-point grid system with `rem` units for quantization. Values can be defined for different breakpoints like `xs` (extra small) and `md` (medium) to achieve responsive layouts.
```JavaScript
// Padding
p={{ xs: '1rem', md: '4rem' }}
// Padding Directional
p={{ x: { xs: '1rem', md: '4rem' }, y: { xs: '2rem', md: '0rem' }}}
// Margin
m={{ xs: '1rem', md: '4rem' }}
// Margin Directional
m={{ x: { xs: '1rem', md: '4rem' }, y: { xs: '2rem', md: '0rem' }}}
// Height
h={{ xs: '1rem', md: '4rem' }}
// Width
h={{ xs: '1rem', md: '4rem' }}
```
--------------------------------
### Change Atomize React Grid Column Count via Theme
Source: https://atomizecode.com/react/theme
This example illustrates how to modify the default column count of the Atomize React grid system. By setting the `colCount` property within the theme object passed to `ThemeProvider`, developers can customize the grid's base number of columns, enabling flexible and non-standard grid layouts.
```JavaScript
import {
ThemeProvider,
Div,
Row,
Col } from "atomize";
const theme = {
colCount: 9
};
ReactDOM.render(
{[1, 2, 3, 4, 5, 6, 7, 8, 9].map(index => (
))}
, mountNode
);
```
--------------------------------
### Add New Custom Colors to Atomize React Theme
Source: https://atomizecode.com/react/theme
This example illustrates how to extend Atomize React's color palette by adding entirely new custom color names and their corresponding hexadecimal values to the theme object via `ThemeProvider`. This allows for greater flexibility in design by introducing unique colors not present in the default set.
```JavaScript
import { ThemeProvider, Div } from "atomize";
const theme = {
colors: {
myColor: '#234423'
}
};
ReactDOM.render(
myColor
, mountNode
);
```
--------------------------------
### Atomize Tag Component API Documentation
Source: https://atomizecode.com/react/atoms
Comprehensive API documentation for the Atomize Tag component, detailing all available properties, their types, and default values. This includes options for content, layout, styling, text, and interactive behaviors.
```APIDOC
Tag Component Props:
tag: string (default: span)
- HTML tag to render the component as.
prefix: ReactNode (default: -)
- Content to display before the tag's children.
suffix: ReactNode (default: -)
- Content to display after the tag's children.
p: object (default: { x: "0.5rem", y: "0.125rem" })
- Padding utility prop.
m: string | object (default: -)
- Margin utility prop.
d: string (default: inline-flex)
- Display utility prop.
align: string (default: center)
- Align items utility prop.
justify: string (default: center)
- Justify content utility prop.
flexDir: string (default: -)
- Flex direction utility prop.
flexGrow: number (default: -)
- Flex grow utility prop.
flexWrap: string (default: -)
- Flex wrap utility prop.
order: number (default: -)
- Flex order utility prop.
rounded: string | number (default: sm)
- Border radius utility prop.
bg: string (default: gray300)
- Background color utility prop.
hoverBg: string (default: -)
- Background color on hover utility prop.
h: string | number (default: -)
- Height utility prop.
maxH: string | number (default: -)
- Max height utility prop.
minH: string | number (default: -)
- Min height utility prop.
w: string | number (default: -)
- Width utility prop.
maxW: string | number (default: -)
- Max width utility prop.
minW: string | number (default: -)
- Min width utility prop.
border: string | number (default: -)
- Border utility prop.
borderColor: string (default: -)
- Border color utility prop.
hoverBorderColor: string (default: -)
- Border color on hover utility prop.
textSize: string (default: caption)
- Text size utility prop.
textWeight: number | string (default: 500)
- Text weight utility prop.
textDecor: string (default: -)
- Text decoration utility prop.
textTransform: string (default: -)
- Text transform utility prop.
textAlign: string (default: center)
- Text align utility prop.
textColor: string (default: medium)
- Text color utility prop.
hoverTextColor: string (default: -)
- Text color on hover utility prop.
fontFamily: string (default: -)
- Font family utility prop.
shadow: string | number (default: -)
- Shadow utility prop.
hoverShadow: string | number (default: -)
- Shadow on hover utility prop.
position: string (default: -)
- Position utility prop.
top: string | number (default: -)
- Top position utility prop.
left: string | number (default: -)
- Left position utility prop.
right: string | number (default: -)
- Right position utility prop.
bottom: string | number (default: -)
- Bottom position utility prop.
transform: string (default: -)
- Transform utility prop.
transition: string (default: -)
- Transition utility prop.
overflow: string (default: -)
- Overflow utility prop.
cursor: string (default: -)
- Cursor style utility prop.
```
--------------------------------
### Creating Basic Links with Atomize Anchor Component
Source: https://atomizecode.com/react/atoms
This React functional component demonstrates how to use the Atomize `Anchor` component to create standard and underlined links. It showcases setting the `href` and `target` attributes, along with applying Atomize-specific styling props like `d` (display) and `m` (margin) for layout, and `textDecor` for visual styling.
```javascript
import { Div, Tag, Anchor, Icon } from "atomize";
const BasicLinks = () => {
return (
<>
This is the link
This is the underlined link
>
);
}
```
--------------------------------
### Atomize Icon Component Props
Source: https://atomizecode.com/react/atoms
Documentation for available properties of the Atomize `Icon` component, including icon name, color, size, and layout options.
```APIDOC
Icon Component Props:
name: string (Default: -) - Name of the icon to display.
color: string (Default: black) - Color of the icon.
hoverColor: string (Default: -) - Hover color of the icon.
size: string (Default: 24px) - Size of the icon.
p: string (Default: -) - Padding utility prop.
m: string (Default: -) - Margin utility prop.
d: string (Default: -) - Display utility prop.
order: string (Default: -) - Flexbox order utility prop.
position: string (Default: -) - Position utility prop.
top: string (Default: -) - Top position utility prop.
left: string (Default: -) - Left position utility prop.
right: string (Default: -) - Right position utility prop.
bottom: string (Default: -) - Bottom position utility prop.
transform: string (Default: -) - Transform utility prop.
cursor: string (Default: -) - Cursor utility prop.
```
--------------------------------
### Create Various Icon Buttons with Atomize
Source: https://atomizecode.com/react/atoms
Illustrates how to create different types of circular and rounded icon buttons using Atomize `Button` and `Icon` components, applying various background colors, hover effects, and shadows.
```jsx
// Icon Buttons
import { Div, Button } from "atomize";
// Search Button
// Bookmark Button
// Delete Button
// Play Button
// Heart Button
// Camera Button