8cadd00d34
Created by Github action --------- Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: github-actions <github-actions@twenty.com>
105 lines
4.3 KiB
Plaintext
105 lines
4.3 KiB
Plaintext
---
|
|
title: راديو
|
|
image: /images/user-guide/create-workspace/workspace-cover.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/create-workspace/workspace-cover.png" alt="Header" />
|
|
</Frame>
|
|
|
|
تستخدم عندما يمكن للمستخدمين اختيار خيار واحد فقط من سلسلة من الخيارات.
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```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="Props">
|
|
|
|
| المحددات | النوع | الوصف |
|
|
| ------------------------ | ----------------- | -------------------------------------------------------------------------------------------------------- |
|
|
| النمط | خصائص `React.CSS` | أنماط إضافية مضمنة للمكون |
|
|
| className | string | فئة CSS اختيارية للتنسيق الإضافي |
|
|
| مختار | قيمة منطقية | يشير إلى ما إذا كان زر الراديو محددًا |
|
|
| القيمة | string | التسمية أو النص المرتبط بزر الراديو |
|
|
| عند التغيير | وظيفة | The function called when the selected radio button is changed |
|
|
| عند تغيير الحالة المحددة | function | The function called when the `checked` state of the radio button changes |
|
|
| الحجم | string | حجم زر الراديو. Options include: `large` and `small` |
|
|
| معطل | قيمة منطقية | If `true`, the radio button is disabled and not clickable |
|
|
| موضع التسمية | string | موضع نص التسمية بالنسبة لزر الراديو. Has two options: `left` and `right` |
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
## مجموعة الراديو
|
|
|
|
يجمع أزرار الراديو ذات الصلة معًا.
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```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="Props">
|
|
|
|
| المحددات | النوع | الوصف |
|
|
| ------------- | ----------------- | ----------------------------------------------------------------------------------------------------- |
|
|
| القيمة | string | قيمة زر الراديو المحدد حاليًا |
|
|
| عند التغيير | function | The callback function triggered when the radio button is changed |
|
|
| onValueChange | function | The callback function triggered when the selected value in the group changes. |
|
|
| الأبناء | `React.ReactNode` | Allows you to pass React components (such as Radio) as children to the Radio Group |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|