Package Data | |
---|---|
Maintainer Username: | sixlive |
Maintainer Contact: | oss@tjmiller.co (TJ Miller) |
Package Create Date: | 2018-10-08 |
Package Last Update: | 2019-09-15 |
Home Page: | |
Language: | Vue |
License: | MIT |
Last Refreshed: | 2024-11-17 03:06:55 |
Package Statistics | |
---|---|
Total Downloads: | 615,945 |
Monthly Downloads: | 7,514 |
Daily Downloads: | 47 |
Total Stars: | 70 |
Total Watchers: | 4 |
Total Forks: | 15 |
Total Open Issues: | 8 |
A Laravel Nova text field with click to copy support. This field behaves just like a text field but adds the ability to copy the field value to your clipboard with just a click.
This package can also be found on Nova Packages.
> composer require sixlive/nova-text-copy-field
Add the field to a resource.
use Sixlive\TextCopy\TextCopy;
public function fields(Request $request)
{
return [
TextCopy::make('Example Copy Field', 'example_copy_field'),
];
}
In some cases you may want to truncate the display of a fields value but allow still copy the full value. You can use the truncate()
method to accomplish this.
TextCopy::make('Some Long Field')
->truncate(100)
This works great for secrets like API Keys.
TextCopy::make('Some Secret String', 'some_secret_string')
->mask('❌') // default '*'
->truncate(5)
The title of the copy button defaults to the field name prefixed with 'Copy'. For example, TextCopy::make('Some Field', 'some_field')
the button title will be "Copy Some Field".
If you would like to manually set the title you can use the copyButtonTitle()
method.
TextCopy::make('Some Field', 'some_field')
->copyButtonTitle('Some alternative title')
You can choose to mutate and that is copied to the users clipboard. You can either pass a value or a Closure.
TextCopy::make('Some Secret String', 'some_long_string')
->copyValue(function ($value) {
return substr($value, -6);
})
or
TextCopy::make('Some Secret String', 'some_long_string')
->copyValue('some fixed copy value')
TextCopy::make('Some Secret String', 'some_long_string')
->showButtonOnlyOnHover()
When the field value has been successfully copied to the user's clipboard.
When there is an error adding the field value to the user's clipboard.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
StyleCI will apply the Laravel preset.
If you discover any security related issues, please email oss@tjmiller.co instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.