How to overwrite classes of a checked radio button in a button group #1582
-
| I have a button group with multiple outlined RadioButtons. As default, clicked ("checked") radio buttons have css classes which add an outline to the button as defined in file https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/forms/radio-button/theme.ts import { tv } from "tailwind-variants";
export const radioButton = tv({
  base: "",
  variants: {
    inline: {
      true: "inline-flex",
      false: "flex"
    },
    checked: {
      true: "outline-4 outline-green-500"
    }
  },
  defaultVariants: {
    inline: true
  }
});I want to overwrite these css classes and set custom ones. E.g. remove this outline and set a colored background. Ob both screenshots, button one is selected. How can I accomplish this? | 
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
| Show me your code please. | 
Beta Was this translation helpful? Give feedback.
-
| This is how it used in the project: <script>
	import { ButtonGroup, Label, RadioButton } from 'flowbite-svelte';
	let options = $state();
</script>
<Label class="mb-1" for="options">Options</Label>
<ButtonGroup class="w-full">
         <RadioButton
		outline
		class="grow justify-center p-3"
		name="options"
		value="Option 1"
		bind:group={options}
		>Option 1</RadioButton>
        <RadioButton
		outline
		class="grow justify-center p-3"
		name="options"
		value="Option 2"
		bind:group={options}
		>Option 2</RadioButton>
</ButtonGroup>It is shortened down to the usage itself as I can't show the complete code because of company guidelines | 
Beta Was this translation helpful? Give feedback.
-
| Since RadioButton component is using Button component, you need to use   | 
Beta Was this translation helpful? Give feedback.
-
| v1.0.7 can use   | 
Beta Was this translation helpful? Give feedback.
-
| Thank you for your efforts. This works as aspected. Great work! | 
Beta Was this translation helpful? Give feedback.



v1.0.7 can use
colorandcheckedClassto style checked state.