) => {
// Handle Enter and Space for keyboard accessibility
if (disabled) return;
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
onClick?.(event as any);
}
};
// =========================================================================
// Render
// =========================================================================
return (
{children}
);
}
);
Component.displayName = 'Component';
// ============================================================================
// Compound Components (if applicable)
// ============================================================================
/**
* Example of a compound component pattern
*/
export const ComponentHeader = ({ children }: { children: React.ReactNode }) => {
return {children}
;
};
/**
* Compound component for body content
*/
export const ComponentBody = ({ children }: { children: React.ReactNode }) => {
return {children}
;
};
// Attach compound components
Component.Header = ComponentHeader;
Component.Body = ComponentBody;
// ============================================================================
// Usage Examples (for documentation/Storybook)
// ============================================================================
/**
* Example 1: Basic usage
*/
export const BasicExample = () => (
Click me
);
/**
* Example 2: With different variants
*/
export const VariantsExample = () => (
Primary
Secondary
Outline
Ghost
);
/**
* Example 3: With different sizes
*/
export const SizesExample = () => (
Small
Medium
Large
);
/**
* Example 4: Disabled state
*/
export const DisabledExample = () => (
Disabled
);
/**
* Example 5: Compound component usage
*/
export const CompoundExample = () => (
Header
Body content
);
// ============================================================================
// Exports
// ============================================================================
export default Component;