### Basic InputSlider Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/InputSlider/README.md
A basic example of the InputSlider component with predefined tags for values. It demonstrates how to set initial values and display currency.
```jsx
() => {
const [value, setValue] = React.useState(50);
const changeHandler = (e) => {
setValue(parseInt(e) || 0);
};
return (
0 $50 $100 $
);
}
```
--------------------------------
### Install ViennaUI Components
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/README.md
Installs the main ViennaUI React components library using either npm or yarn package managers.
```bash
$ npm i vienna-ui
$ yarn add vienna-ui
```
--------------------------------
### Install Specific ViennaUI Packages
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/README.md
Installs individual packages from the ViennaUI ecosystem, such as icons, tokens, or utility functions.
```bash
$ npm i
$ yarn add
```
--------------------------------
### Grid Layout Examples
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Grid/README.md
Provides various examples of Grid layouts, showcasing different column distributions (12 columns, halves, thirds, quarters).
```jsx
111111111111One of two columnsOne of two columnsOne of three columnsOne of three columnsOne of three columnsOne of four columnsOne of four columnsOne of four columnsOne of four columns
```
--------------------------------
### Basic CssGrid Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/CssGrid/README.md
An example of using the CssGrid component to create a grid layout with specified rows and columns, populating it with child elements.
```html
123456789
```
--------------------------------
### CardVersatile Component Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/CardVersatile/README.md
A comprehensive example showcasing the usage of the CardVersatile component with various properties like title, icon, counter, hint, badge, extraText, subtitle, and info.
```jsx
Some text
```
--------------------------------
### Interactive Example with Custom Buttons
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/MultiselectWithSearch/README.md
Provides an interactive example showcasing custom 'Select All' and 'Clear' buttons alongside the MultiselectWithSearch component. It demonstrates how to manage the state and trigger actions for selecting or clearing all options.
```jsx
{
const [state, setValue] = React.useState({ values: [] });
const handleSelect = (data) => setValue({ values: data.value });
const checkAll = () => setValue({ values: ['Значение 1', 'Значение большое 2', 'Значение еще больше 3', 'Знач. 4', 'Значение 5'] });
const uncheckAll = () => setValue({ values: [] });
return (
);
}
```
--------------------------------
### ComboButton Usage Examples
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/ComboButton/README.md
Provides examples of using the ComboButton component with different designs and configurations, including single-button and double-button variants. It showcases how to define options and integrate with Button components.
```javascript
{
const options = [
console.log(e.target)} key={1}>
Option 1
,
console.log(e.target)} key={2}>
Option 2
,
console.log(e.target)} key={3}>
Option 3
,
];
return (
);
}
```
```javascript
{
const options = [
Option 1,
Option 2,
Option 3,
Option 4,
Option 5,
];
return (
);
}
```
```javascript
{
const options = [
Option 1,
Option 2,
Option 3,
Option 4,
Option 5,
];
return (
);
}
```
--------------------------------
### Skeleton Line Design Examples
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Skeleton/README.md
Shows examples of the Skeleton component with 'line' design, illustrating different sizes ('s', 'm', 'l', 'xl') and width customization.
```html
```
--------------------------------
### Drawer Component Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Drawer/README.md
Provides a practical example of using the Drawer component in a React application. It shows how to control the drawer's visibility using state and includes common elements like a header, body, and footer with buttons.
```javascript
{
() => {
const [isOpen, setOpen] = React.useState(false);
return (
<>
setOpen(false)}>
Enter SMS-codeDrawer SubHeader
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Amet cursus sit amet dictum sit amet justo
donec enim. Sit amet porttitor eget dolor morbi non. Ipsum consequat nisl vel pretium
lectus quam id leo in. Duis ut diam quam nulla porttitor massa. Id volutpat lacus
laoreet non. Etiam non quam lacus suspendisse faucibus. Mollis aliquam ut porttitor leo
a diam. Auctor urna nunc id cursus metus aliquam. In dictum non consectetur a erat nam
at lectus. Facilisi cras fermentum odio eu feugiat. Risus commodo viverra maecenas
accumsan. Interdum velit euismod in pellentesque massa placerat duis ultricies. Ac ut
consequat semper viverra nam libero justo. Dapibus ultrices in iaculis nunc sed augue
lacus viverra.
>
);
}
}
```
--------------------------------
### Alarm Component Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Alarm/READMEENG.md
Demonstrates how to use the Alarm component with a 'success' design.
```jsx
```
--------------------------------
### React Usage Example for Viennaui Drawer
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Drawer/README.md
A complete React example showcasing the integration of the Viennaui Drawer component. It includes state management for drawer visibility, passing custom `testId` props, and structuring content within the Drawer's layout, header, body, and footer.
```javascript
{
() => {
const [isOpen, setOpen] = React.useState(false);
return (
<>
setOpen(false)} testId={{ btnClose: 'btnClose', overlay: 'overlay' }}>
Enter SMS-codeDrawer SubHeader
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Amet cursus sit amet dictum sit amet justo
donec enim. Sit amet porttitor eget dolor morbi non. Ipsum consequat nisl vel pretium
lectus quam id leo in. Duis ut diam quam nulla porttitor massa. Id volutpat lacus
laoreet non. Etiam non quam lacus suspendisse faucibus. Mollis aliquam ut porttitor leo
a diam. Auctor urna nunc id cursus metus aliquam. In dictum non consectetur a erat nam
at lectus. Facilisi cras fermentum odio eu feugiat. Risus commodo viverra maecenas
accumsan. Interdum velit euismod in pellentesque massa placerat duis ultricies. Ac ut
consequat semper viverra nam libero justo. Dapibus ultrices in iaculis nunc sed augue
lacus viverra.
>
);
}
}
```
--------------------------------
### Basic Textarea Usage
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Textarea/README.md
Shows a basic example of using the Textarea component with a placeholder.
```javascript
```
--------------------------------
### Basic Timer Usage
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Timer/README.md
A simple example of rendering the Timer component without any props.
```html
```
--------------------------------
### useInterval Hook Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Timer/README.md
Demonstrates the usage of the `useInterval` hook to manage a counter that increments every second. The timer can be started or stopped by clicking a button.
```javascript
() => {
const [count, update] = React.useState(0);
const [stoped, stop] = React.useState(false);
useInterval(
() => {
update(count + 1);
},
stoped ? null : 1000
);
return (
{count}
);
}
```
--------------------------------
### Aligning Search Suggestions
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Search/README.md
Demonstrates how to align search suggestions to the start or end of the input field using the 'align' parameter. This example uses React state and callbacks to manage the search input and suggestions.
```jsx
{
const [value, setValue] = React.useState('');
const [suggests, setSuggests] = React.useState();
const handleChange = React.useCallback((data) => {
const mock = [
'Райффайзен банк',
'Райффайзен IT',
'Иванов Иван Иванович',
'Иванов Иван Петрович',
'Ивановская область',
'Рамблер',
];
const regexp = new RegExp(`^${data.value.toUpperCase()}`);
const temp = (data.value && mock.filter((m) => regexp.test(m.toUpperCase()))) || [];
setSuggests(temp);
setValue(data.value);
}, []);
const handleSelect = React.useCallback((data) => {
setValue(data.value);
}, []);
return (
);
}
```
--------------------------------
### Basic Wizard Usage
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Wizard/README.md
Demonstrates the basic structure of the Wizard component with multiple steps and a footer.
```javascript
12345Footer
```
--------------------------------
### ComboButton Positioning Examples
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/ComboButton/README.md
Demonstrates various combinations of 'align' and 'float' properties for the ComboButton component to control its positioning relative to the parent. 'align' controls the vertical or horizontal alignment, while 'float' controls the start or end alignment.
```jsx
{
const options = Array.from(Array(5).keys()).map((i) => (
Option Option {i}
));
return (
);
}
```
--------------------------------
### Tour Component Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Tour/README.md
Demonstrates how to use the Tour component in a React application. It includes state management for tour visibility and defines an array of steps with various configurations like selectors, content, and event handlers.
```javascript
{
() => {
const [showTour, setShowTour] = React.useState(false);
const steps = [
{
selector: '.start-tour',
highlightedSelectors: [],
type: 'accent',
content: {
title: 'Начнем знакомиться?',
description: 'Это accent',
},
backButtonText: 'Позже',
nextButtonText: 'Начнем',
},
{
selector: '.fist-step',
content: {
title: 'Title 1',
description: 'description 1',
image: 'https://insider-test.raiffeisen.ru/uploads/article/11320/previews/detail.jpg?1725975927224',
},
maskRadius: 8,
onEnter: () => {
console.log('ENTER');
},
onLeave: () => {
console.log('LEAVE');
},
},
{
selector: '.second-step',
content: {
title: 'Title 2',
description: 'description 2',
},
maskRadius: 8,
position: 'right'
},
{
selector: '.third-step',
type: 'accent',
content: {
title: 'Title 3',
description: 'description 3',
},
position: 'left',
},
{
selector: '.fourth-step',
content: {
title: 'Title 4',
description: 'description 4',
},
position: 'bottom'
},
{
selector: '.fifth-step',
content: {
title: 'Title 5',
description: 'description 5',
},
onLeave: () => {
console.log('CLOSE TOUR');
},
position: 'left'
},
];
return (
setShowTour(val)}
/>
);
}
}
```
--------------------------------
### Timer with Start and Stop Values
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Timer/README.md
Configures the timer to start at 100 and stop at 110 using the 'start' and 'stop' props.
```html
```
--------------------------------
### InputSlider Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/InputSlider/README.md
Demonstrates how to use the InputSlider component with state management, event handling, and custom tags. It showcases setting min, max, initial value, and handling value changes.
```javascript
{
() => {
const [value, setValue] = React.useState(50);
const changeHandler = (e) => {
setValue(parseInt(e));
};
return (
20 $50 $100 $
);
}
}
```
--------------------------------
### Interactive Filter Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Filter/README.md
An example of an interactive Filter component where items can be removed.
```javascript
() => {
const [state, setState] = React.useState({ a: true, b: true, c: true });
return (
{state.a && (
setState((old) => ({ ...old, ...{ a: false } }))}>Пол
)}
{state.b && (
setState((old) => ({ ...old, ...{ b: false } }))}>
Рост очень высокий
)}
{state.c && (
setState((old) => ({ ...old, ...{ c: false } }))}>Вес
)}
);
}
```
--------------------------------
### Horizontal Divider Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Divider/README.md
Provides an example of a horizontal Divider used to separate content blocks.
```javascript
{() => {
return(
Твердислав Николаевич Пьянка
Администратор
Анатолий Петрович Непонятых
Оператор
)
}}
```
--------------------------------
### FileLoader Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/FileLoader/README.md
Demonstrates how to use the FileLoader component with state management for files. It includes handlers for adding new files and deleting existing ones.
```javascript
() => {
const [files, setFiles] = React.useState([]);
const changeHandler = React.useCallback(
({ value: newFiles }) => {
setFiles([...files, ...newFiles]);
},
[files]
);
const deleteHandler = React.useCallback(
(file) => {
setFiles(files.filter((f) => f !== file));
},
[files]
);
return (
{files.map((f, i) => (
))}
);
}
```
--------------------------------
### Monthpicker Localization Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Monthpicker/README.md
Provides an example of localizing the Monthpicker component by passing a locale object from `date-fns/locale` and custom localization strings.
```javascript
import React from 'react';
import { Monthpicker } from 'vienna-ui';
import { enGB } from 'date-fns/locale'; // Assuming enGB is imported
function App() {
const [value, setValue] = React.useState();
const handleChange = React.useCallback(
({ value }) => setValue(value),
[]
);
const calendarLocalization = {
'ds.calendar.month.january': 'Jan.',
'ds.calendar.month.february': 'Feb.',
'ds.calendar.month.march': 'Mar.',
'ds.calendar.month.april': 'Apr.',
'ds.calendar.month.may': 'May',
'ds.calendar.month.june': 'Jun.',
'ds.calendar.month.july': 'Jul',
'ds.calendar.month.august': 'Aug.',
'ds.calendar.month.september': 'Sep.',
'ds.calendar.month.october': 'Oct.',
'ds.calendar.month.november': 'Nov.',
'ds.calendar.month.december': 'Dec.'
};
return (
);
}
```
--------------------------------
### Basic Steps Usage
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Steps/README.md
Shows the fundamental structure for using the Steps component with individual Steps.Step elements.
```javascript
```
--------------------------------
### Dynamic Option Loading
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/MultiselectWithSearch/README.md
Demonstrates how to load options dynamically, for example, after an API call or a delay. This example uses `setTimeout` to simulate fetching options.
```jsx
const [options, setOptions] = React.useState([]);
const [values, setValues] = React.useState([]);
const handleSelect = ({ value }) => setValues(value);
React.useEffect(() => {
setTimeout(() => {
setOptions(['Значение 1', 'Значение большое 2', 'Значение еще больше 3', 'Знач. 4', 'Значение 5']);
}, 3000);
}, []);
return (
);
```
--------------------------------
### Nested Modals Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Modal/README.md
Demonstrates how to implement nested modals, where one modal can trigger the opening of another. This example uses `ComponentHelpers.Modal.confirmModal` to show a confirmation dialog from within a modal.
```jsx
{
() => {
const showModal = React.useCallback(() => {
ComponentHelpers.Modal.confirmModal('Продолжить выполнение операции?').then(console.log);
}, []);
const [open, close] = useModal(
Modal header
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua.
);
return (
);
}
}
```
--------------------------------
### Drawer Component Usage Example
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Drawer/README.md
Demonstrates the basic structure and usage of the Drawer component, including its layout, body, footer, and interactive buttons. It shows how to manage the drawer's open/closed state using a toggle.
```jsx
<>
setToggle(false)}>
Drawer Title setToggle(false)} />
{/* Content of the drawer */}
>
```
--------------------------------
### Popover Component Updates
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/CHANGELOG_LLM.md
Shows the removal of 'fontSize' and 'fontWeight' props from the Popover component. These props were present in the 'before' example but omitted in the 'after' example.
```jsx
return (
{ref => }
{ref => }
)
```
```jsx
return (
{ref => }
{ref => }
)
```
--------------------------------
### Skeleton Circle Design Examples
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Skeleton/README.md
Shows examples of the 'circle' design for Skeleton, with variations in size ('s', 'm', 'l', 'xl') for circular placeholders.
```html
```
--------------------------------
### Basic Collapse Usage
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Collapse/README.md
Demonstrates the basic usage of the Collapse component with a header and content.
```jsx
Content: text, table, image or another component
```
--------------------------------
### Basic Highlight Usage
Source: https://github.com/raiffeisen-dgtl/viennaui/blob/master/src/Highlight/README.md
Demonstrates the basic usage of the Highlight component with a query string.
```javascript
{
() => {
return (
Значение
);
}
}
```