### Minimal Konsta App Setup
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/00-component-inventory.md
This example demonstrates the basic structure for a Konsta application, including the necessary provider and root components. It shows how to render a page with a navbar, a list, and a button.
```javascript
import { App, KonstaProvider, Page, Navbar, Button, List, ListItem } from 'konsta/react';
export default function MyApp() {
return (
);
}
```
--------------------------------
### Full Screen App Component Setup
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/03-app-container.md
Example of configuring the App component for a full-screen application with dark mode and safe area handling enabled.
```javascript
{/* App content */}
```
--------------------------------
### Install Dependencies with npm
Source: https://github.com/konstaui/konsta/blob/master/README.md
Run this command to install all project dependencies before development.
```bash
$ npm install
```
--------------------------------
### Konsta UI Block Component Usage Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/03-app-container.md
Demonstrates how to use the Block component with its header, title, and footer. This example shows common props like 'inset' and 'strong' for styling.
```javascript
Section Title
Block content here
Additional info
```
--------------------------------
### Basic List Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/06-lists.md
A simple list with three items.
```javascript
```
--------------------------------
### Searchbar Usage Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/07-form-inputs.md
Demonstrates how to use the Searchbar component with state management for input value and clear functionality.
```javascript
const [search, setSearch] = useState('');
setSearch(e.target.value)}
onClear={() => setSearch('')}
placeholder="Search..."
/>
```
--------------------------------
### Link Button Examples
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/04-buttons-links.md
Shows how to use the Button component as a link by providing an `href` prop, with an outline variant.
```javascript
```
```javascript
```
--------------------------------
### Segmented Control Button Examples
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/04-buttons-links.md
Provides an example of creating a segmented control using multiple Button components with specific props for active and strong states.
```javascript
```
--------------------------------
### Inset List Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/06-lists.md
An inset list with margins on the sides. Use the 'inset' prop to apply this style.
```javascript
```
--------------------------------
### Strong List Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/06-lists.md
A list with a strong background highlighting. Apply the 'strong' prop for this effect.
```javascript
```
--------------------------------
### Basic Fill Button Examples
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/04-buttons-links.md
Demonstrates the default, large, small, rounded, raised, and disabled states of the fill button.
```javascript
```
```javascript
```
```javascript
```
```javascript
```
```javascript
```
```javascript
```
--------------------------------
### ListButton Usage Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/06-lists.md
Demonstrates how to use the ListButton component within a List. Supports titles, subtitles, and click handlers.
```javascript
handleOption(1)}
/>
handleOption(2)}
/>
```
--------------------------------
### Auto Theme Detection Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/12-utilities-helpers.md
Demonstrates how to use the auto theme detection by setting a class on the HTML element. This is typically handled automatically by the provider.
```html
{/* Content automatically uses iOS theme */}
```
--------------------------------
### Basic FAB Usage
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/04-buttons-links.md
A basic example of a Floating Action Button positioned at the bottom-right. It includes an 'add' icon.
```javascript
add
```
--------------------------------
### Basic Popup Usage Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/08-dialogs-overlays.md
Demonstrates how to use the Popup component with state management for opening and closing. It includes a close button and handles backdrop clicks to close the popup.
```javascript
const [popupOpened, setPopupOpened] = useState(false);
setPopupOpened(false)}
onBackdropClick={() => setPopupOpened(false)}
closeButton={true}
>
setPopupOpened(false)} />} />
Popup content here
```
--------------------------------
### Usage Example for Sheet
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/08-dialogs-overlays.md
Shows how to implement a basic Sheet component that slides up from the bottom. Manage the opened state and close handlers for backdrop clicks and explicit closing.
```javascript
const [sheetOpened, setSheetOpened] = useState(false);
setSheetOpened(false)}
onBackdropClick={() => setSheetOpened(false)}
>
Sheet content here
```
--------------------------------
### Tonal Button Examples
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/04-buttons-links.md
Demonstrates the tonal button style, featuring a semi-transparent background, with a rounded variant.
```javascript
```
```javascript
```
--------------------------------
### Usage Example for Popover
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/08-dialogs-overlays.md
Demonstrates how to open and close a Popover component anchored to a button. Ensure the target ref is correctly set and the opened state is managed.
```javascript
const [popoverOpened, setPopoverOpened] = useState(false);
const popoverTarget = useRef(null);
<>
setPopoverOpened(false)}
>
>
```
--------------------------------
### Outline Button Examples
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/04-buttons-links.md
Showcases outline buttons with options for rounded corners and platform-specific outline styles.
```javascript
```
```javascript
```
```javascript
```
```javascript
```
--------------------------------
### ListInput Usage Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/06-lists.md
Shows how to integrate the ListInput component for email input. It manages state with useState and handles changes via onChange.
```javascript
const [email, setEmail] = useState('');
setEmail(e.target.value)}
/>
```
--------------------------------
### Basic Breadcrumbs Usage
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/05-navigation.md
Example of a basic breadcrumb navigation structure with items and separators.
```javascript
HomeProductsCurrent Page
```
--------------------------------
### Card Component Usage Example
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/03-app-container.md
Demonstrates how to use the Card component with header content and footer text. The content within the Card tags will be displayed as the main body of the card.
```javascript
Card content here
```
--------------------------------
### Simple Dialog Usage
Source: https://github.com/konstaui/konsta/blob/master/_autodocs/08-dialogs-overlays.md
Example of a simple dialog with a title, content, and a single OK button. Used for displaying success messages or confirmations.
```javascript