nova-text-copy-field
nova-text-copy-field copied to clipboard
Set text label/value next to button
It would be useful to be able to override the text shown by the button. For instance I want to use a generated copyValue that has no corresponding row in the database in meaning only the button shows.
TextCopy::make('Social link')
->copyValue(function () {
return $this->url;
}),
Other times I might have a long item to copy like a URL and rather and truncate it, it would ne good to supply different word like copy link.
At the moment I work around it by supplying a second argument to the make method which uses an accessor on the model that returns a string.
// resource
TextCopy::make('Social link', 'social_link_copy_label')
->copyValue(function () {
return $this->url;
}),
// model
public function getSocialLinkCopyLabelAttribute()
{
return 'Copy url';
}
To clarify, you are looking for the button text to be flexible. So rather than the "copy icon", you could set your own value to something like "Copy Link"