- How do I add a copy-to-clipboard button to a Filament TextInput field?
- Use the `moox/clipboard` package’s `CopyButton` modifier. Wrap your `TextInput` field with `TextInput::make()->copyable()` or apply it via the `modify()` method in your Filament resource. The package automatically injects a clipboard icon and handles the JavaScript interaction.
- Does Moox Clipboard work with Filament v3.x?
- Yes, the package is designed for Filament v3.x. Always check the package’s `composer.json` for the exact supported version range. If you’re using a newer Filament version, verify compatibility or check the GitHub issues for updates.
- Can I customize the copy button’s appearance to match my Filament theme?
- Absolutely. Moox Clipboard respects Filament’s CSS variables and allows customization via Tailwind classes or inline styles. You can override the button’s appearance by targeting the `.moox-clipboard-button` class in your global CSS or resource-specific styles.
- What happens if a user’s browser blocks clipboard access?
- The package includes fallback behavior. If clipboard access is denied, it shows a user-friendly toast notification (e.g., ‘Permission denied’) instead of failing silently. You can customize this message via the `copyFailedMessage` option in the field configuration.
- Is Moox Clipboard compatible with Filament’s Livewire or Inertia setups?
- Yes, the package works seamlessly with Livewire and Inertia since it relies on Filament’s built-in field rendering system. No additional JavaScript or backend logic is required—clipboard actions are handled client-side via the browser’s Clipboard API.
- Can I use Moox Clipboard for sensitive data like API keys or passwords?
- While the package itself doesn’t enforce security, it’s designed to work with Filament’s existing access controls (e.g., policies, gates). Always ensure your Filament resources restrict access to sensitive fields. Avoid using clipboard actions on password fields or other highly sensitive data.
- How do I test Moox Clipboard in my Laravel application?
- Test by creating a Filament resource with a field wrapped in `copyable()`. Use browser dev tools to mock clipboard interactions or manually trigger the copy action. For automated testing, use Laravel’s browser testing tools to simulate clipboard events and verify toast notifications.
- Does Moox Clipboard support bulk copying (e.g., copying multiple rows at once)?
- Not natively, but you can extend the package to support bulk actions. For example, add a custom button in a Filament Table’s header that copies selected row values to the clipboard using JavaScript’s `clipboard.writeText()` method with a loop or delimiter-separated string.
- Are there alternatives to Moox Clipboard for Filament?
- Yes, alternatives include custom JavaScript solutions (e.g., using Alpine.js or Livewire) or third-party packages like `filament-spatie/laravel-filament-copy-button`. However, Moox Clipboard offers deeper Filament integration, built-in styling, and a more polished user experience out of the box.
- How do I contribute to Moox Clipboard’s development or report bugs?
- Check the GitHub repository for contribution guidelines. Bugs can be reported via GitHub Issues, and pull requests are welcome. The package follows standard open-source practices, so ensure your changes include tests and documentation updates. The mooxphp team is active in maintaining the package.