1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-25 00:11:36 +01:00

Add className prop to CheckBox and Radio components

This commit is contained in:
Aleksandr Gumroian 2024-06-28 10:29:41 +03:00
parent 3b48510246
commit d69398ac06
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733
2 changed files with 7 additions and 4 deletions

View File

@ -17,17 +17,19 @@ CheckBox.propTypes = {
helpText: PropTypes.string,
/** Control if checkbox is clickable */
disabled: PropTypes.bool,
/** Additional class name */
className: PropTypes.string,
};
CheckBox.defaultProps = {
disabled: false,
};
function CheckBox({ label, helpText, disabled, ...props }) {
function CheckBox({ label, helpText, disabled, className, ...props }) {
const uid = useUID();
return (
<div className="mb-3 form-check">
<div className={`${className || "mb-3"} form-check`.trim()}>
<input
className="form-check-input"
type="checkbox"

View File

@ -83,12 +83,13 @@ Radio.propTypes = {
id: PropTypes.string.isRequired,
inline: PropTypes.bool,
helpText: PropTypes.string,
className: PropTypes.string,
};
export function Radio({ label, id, helpText, inline, ...props }) {
export function Radio({ label, id, helpText, inline, className, ...props }) {
return (
<div
className={`mb-2 ${inline ? "form-check form-check-inline" : ""}`.trim()}
className={`${className || "mb-3"} ${inline ? "form-check form-check-inline" : ""}`.trim()}
>
<input
id={id}