snow-editor

small markdown and org-mode editor
Log | Files | Refs | README

IconButton.jsx (464B)


      1 export default function IconButton({
      2   icon,
      3   label,
      4   variant = 'default',
      5   title,
      6   className = '',
      7   type = 'button',
      8   ...rest
      9 }) {
     10   const variantClass = variant === 'ghost' ? ' btn-ghost' : '';
     11   const tooltip = title ?? label;
     12 
     13   return (
     14     <button
     15       type={type}
     16       className={`btn btn-icon${variantClass}${className ? ` ${className}` : ''}`}
     17       aria-label={label}
     18       title={tooltip}
     19       {...rest}
     20     >
     21       {icon}
     22     </button>
     23   );
     24 }