diff --git a/packages/ui/src/Radio/RadioGroup.tsx b/packages/ui/src/Radio/RadioGroup.tsx index 2b8eb47..53a1dfd 100644 --- a/packages/ui/src/Radio/RadioGroup.tsx +++ b/packages/ui/src/Radio/RadioGroup.tsx @@ -15,6 +15,19 @@ export const RadioGroupContext = createContext(nu export const useRadioGroup = () => { const context = useContext(RadioGroupContext); if (!context) { + // During SSR/prerendering, context might not be available yet + // Return default values to prevent build errors + if (typeof window === 'undefined') { + return { + name: '', + value: undefined, + onChange: () => {}, + state: 'default' as const, + size: 'md' as const, + disabled: false, + }; + } + // In browser, this is a real error throw new Error('Radio must be used within a RadioGroup'); } return context;