Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
/ readmore Public archive
forked from mattsplat/readmore

Nova Field to allow text to collapse and expand on click

Notifications You must be signed in to change notification settings

montopolis/readmore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Read More

For the index view adds the ability to shorten text/textarea or show all by clicking on the field.

Works by adding a macro to Laravel Nova Text which is extended by TextArea so it works for both.

Install

composer require mattsplat/readmore

Usage with TextArea

Textarea::make('Notes')
    ->showOnIndex()
    ->readMore(),
                

with options


Textarea::make('Notes')
    ->showOnIndex()
    ->readMore(['mask' => 'Look Here', 'max' => 5]),

or using Text


Text::make('Notes')->readMore(),

Options

  • max - number of characters to display (default 20)
  • mask - text displayed to show all text (default ...)

Use an icon instead of text

$icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path class="heroicon-ui" d="M6 2h9a1 1 0 0 1 .7.3l4 4a1 1 0 0 1 .3.7v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.1.9-2 2-2zm9 2.41V7h2.59L15 4.41zM18 9h-3a2 2 0 0 1-2-2V4H6v16h12V9zm-5 4h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 0v-2H9a1 1 0 0 1 0-2h2v-2a1 1 0 0 1 2 0v2z"/></svg>';

Text::make('Notes')->readMore(['max' => 0, 'mask' => $icon]),

Inspired by

Index TextArea by Brian Dillingham

About

Nova Field to allow text to collapse and expand on click

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vue 53.5%
  • PHP 36.9%
  • JavaScript 9.1%
  • CSS 0.5%