diff --git a/CHANGELOG.md b/CHANGELOG.md index 0915ddb19d..6aadd8c793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,13 @@ it according to semantic versioning. For example, if your PR adds a breaking cha should change the heading of the (upcoming) version to include a major version bump. --> +# 6.0.0-beta.15 + +## @rjsf/shadcn + +- Update `README.md` with picture of the theme! +- Allow passing `className` props to `AddButton`, `BaseInputTemplate`, `CheckboxWidget`, `CheckboxesWidget`, `RadioWidget`, `SelectWidget`, `SubmitButton`, `TextareaWidget` for extra Tailwind CSS customization through `ui:className` + # 6.0.0-beta.14 ## @rjsf/core diff --git a/packages/shadcn/README.md b/packages/shadcn/README.md index 2b789140ef..c6233126e1 100644 --- a/packages/shadcn/README.md +++ b/packages/shadcn/README.md @@ -20,6 +20,11 @@ Request Feature

+ +

+Logo +

+ ## Table of Contents @@ -134,8 +139,7 @@ Supported colors are: #### Coloring - Generate a theme from [official shadCN site](https://ui.shadcn.com/themes) - or [zippy starter's shadcn/ui theme generator](https://zippystarter.com/tools/shadcn-ui-theme-generator) - or [Railly](https://customizer.railly.dev/) + or [tweakcn](https://tweakcn.com/editor/theme) - Navigate to shadcn/css, create a new file called [your-theme].css - Replace the base layer code with your new color - Follow the next section to build your CSS file diff --git a/packages/shadcn/src/AddButton/AddButton.tsx b/packages/shadcn/src/AddButton/AddButton.tsx index 6130db998f..5f9a3cfea1 100644 --- a/packages/shadcn/src/AddButton/AddButton.tsx +++ b/packages/shadcn/src/AddButton/AddButton.tsx @@ -2,20 +2,25 @@ import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, Transla import { PlusCircle } from 'lucide-react'; import { Button } from '../components/ui/button'; +import { cn } from '../lib/utils'; /** * A button component for adding new items in a form + * @param uiSchema - The UI schema for the form, which can include custom properties + * @param registry - The registry object containing the form's configuration and utilities + * @param className - Allow custom class names to be passed for Tailwind CSS styling * @param props - The component properties */ export default function AddButton({ uiSchema, registry, + className, ...props }: IconButtonProps) { const { translateString } = registry; return (
-
diff --git a/packages/shadcn/src/BaseInputTemplate/BaseInputTemplate.tsx b/packages/shadcn/src/BaseInputTemplate/BaseInputTemplate.tsx index e37ff32132..77893c6aec 100644 --- a/packages/shadcn/src/BaseInputTemplate/BaseInputTemplate.tsx +++ b/packages/shadcn/src/BaseInputTemplate/BaseInputTemplate.tsx @@ -40,6 +40,7 @@ export default function BaseInputTemplate< rawErrors = [], children, extraProps, + className, }: BaseInputTemplateProps) { const inputProps = { ...extraProps, @@ -61,7 +62,7 @@ export default function BaseInputTemplate< required={required} disabled={disabled} readOnly={readonly} - className={cn({ 'border-destructive focus-visible:ring-0': rawErrors.length > 0 })} + className={cn({ 'border-destructive focus-visible:ring-0': rawErrors.length > 0 }, className)} list={schema.examples ? examplesId(id) : undefined} {...inputProps} value={value || value === 0 ? value : ''} diff --git a/packages/shadcn/src/CheckboxWidget/CheckboxWidget.tsx b/packages/shadcn/src/CheckboxWidget/CheckboxWidget.tsx index b1588c3f60..559f8a7c92 100644 --- a/packages/shadcn/src/CheckboxWidget/CheckboxWidget.tsx +++ b/packages/shadcn/src/CheckboxWidget/CheckboxWidget.tsx @@ -37,6 +37,7 @@ export default function CheckboxWidget< onFocus, registry, uiSchema, + className, } = props; // Because an unchecked checkbox will cause html5 validation to fail, only add // the "required" attribute if the field value must be "true", due to the @@ -78,6 +79,7 @@ export default function CheckboxWidget< onCheckedChange={_onChange} onBlur={_onBlur} onFocus={_onFocus} + className={className} />