Files
ServerKit/frontend/src/components/IconButton.jsx
T
Juan Denis 7f50e741cd feat: add shared primitives and extract reusable overflow logic
- New useOverflowItems hook for tab overflow menus
- Refactor ui/tabs and ds/PageTopbar to share overflow logic
- New PageLoader component for full-page loading states
- New DataTable component with sorting, empty/loading states, custom rows
- New ResourceCard / ResourceList for servers/apps/domains/containers
- New FormField / FormRow wrappers for consistent forms
- New IconButton wrapper for accessible icon-only actions
- Add supporting styles in _design-system.scss and _forms.scss
2026-06-21 01:10:23 -04:00

40 lines
910 B
React

import React from 'react';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
/**
* Accessible icon-only button. Always provide a descriptive label; it is used
* for the aria-label and optional title.
*
* <IconButton icon={<RefreshCw size={16} />} label="Refresh" onClick={load} />
*/
export function IconButton({
icon,
label,
onClick,
variant = 'ghost',
size = 'sm',
className,
title,
disabled,
...props
}) {
return (
<Button
type="button"
variant={variant}
size="icon"
className={cn('icon-button', size === 'sm' && 'btn-sm', className)}
onClick={onClick}
disabled={disabled}
aria-label={label}
title={title || label}
{...props}
>
{icon}
</Button>
);
}
export default IconButton;