b77c65946f
Created by Github action Co-authored-by: github-actions <github-actions@twenty.com>
114 lines
3.6 KiB
Plaintext
114 lines
3.6 KiB
Plaintext
---
|
|
title: Rádio
|
|
icon: kruh s tečkou
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/create-workspace/workspace-cover.png" alt="Hlavička" />
|
|
</Frame>
|
|
|
|
Používá se, když uživatelé mohou vybrat pouze jednu možnost ze série možností.
|
|
|
|
<Tabs>
|
|
<Tab title="Použití">
|
|
|
|
```jsx
|
|
import { Radio } from "twenty-ui/display";
|
|
|
|
export const MyComponent = () => {
|
|
|
|
const handleRadioChange = (event) => {
|
|
console.log("Radio button changed:", event.target.checked);
|
|
};
|
|
|
|
const handleCheckedChange = (checked) => {
|
|
console.log("Checked state changed:", checked);
|
|
};
|
|
|
|
|
|
return (
|
|
<Radio
|
|
checked={true}
|
|
value="Option 1"
|
|
onChange={handleRadioChange}
|
|
onCheckedChange={handleCheckedChange}
|
|
size="large"
|
|
disabled={false}
|
|
labelPosition="right"
|
|
/>
|
|
);
|
|
};
|
|
|
|
```
|
|
|
|
|
|
</Tab>
|
|
<Tab title="Vlastnosti">
|
|
|
|
|
|
| Vlastnosti | Typ | Popis |
|
|
| --------------- | ---------------------- | ---------------------------------------------------------------------------------- |
|
|
| styl | Vlastnosti `React.CSS` | Další inline styly pro komponentu |
|
|
| className | řetězec | Volitelná CSS třída pro další stylování |
|
|
| zaškrtnuté | booleovská hodnota | Indicates whether the radio button is checked |
|
|
| hodnota | řetězec | Označení nebo text spojený s radiobuttonem |
|
|
| onChange | funkce | The function called when the selected radio button is changed |
|
|
| onCheckedChange | funkce | The function called when the `checked` state of the radio button changes |
|
|
| velikost | řetězec | Velikost radiobuttonu. Možnosti zahrnují: `velký` a `malý` |
|
|
| neaktivní | booleovská hodnota | If `true`, the radio button is disabled and not clickable |
|
|
| labelPosition | řetězec | Pozice textu označení vzhledem k radiobuttonu. Má dvě možnosti: `vlevo` a `vpravo` |
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
## Radio Group
|
|
|
|
Groups together related radio buttons.
|
|
|
|
<Tabs>
|
|
<Tab title="Použití">
|
|
|
|
```jsx
|
|
import React, { useState } from "react";
|
|
import { Radio, RadioGroup } from "twenty-ui/display";
|
|
|
|
export const MyComponent = () => {
|
|
|
|
const [selectedValue, setSelectedValue] = useState("Option 1");
|
|
|
|
const handleChange = (event) => {
|
|
setSelectedValue(event.target.value);
|
|
};
|
|
|
|
return (
|
|
<RadioGroup value={selectedValue} onChange={handleChange}>
|
|
<Radio value="Option 1" />
|
|
<Radio value="Option 2" />
|
|
<Radio value="Option 3" />
|
|
</RadioGroup>
|
|
);
|
|
};
|
|
|
|
```
|
|
|
|
</Tab>
|
|
<Tab title="Vlastnosti">
|
|
|
|
|
|
| Vlastnosti | Typ | Popis |
|
|
| --------------- | ----------------- | ---------------------------------------------------------------------------------- |
|
|
| hodnota | řetězec | Hodnota aktuálně vybraného radiobuttonu |
|
|
| onChange | funkce | The callback function triggered when the radio button is changed |
|
|
| přiZměněHodnoty | funkce | Funkce spouštěná při změně vybrané hodnoty ve skupině. |
|
|
| děti | `React.ReactNode` | Allows you to pass React components (such as Radio) as children to the Radio Group |
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|