shout icon indicating copy to clipboard operation
shout copied to clipboard

Add `title()` method

Open pschilly opened this issue 11 months ago • 2 comments

The title() method has been added to allow the developer to define a title.

use Awcodes\Shout\Components\Shout;

Shout::make('so-important')
                    ->content('This is a test')
                    ->title('Test Shout')
                    ->icon('tabler-alert-circle'),

Creates: image

  • I have included updated README with documentation on the title() function as well.

pschilly avatar Jan 17 '25 19:01 pschilly

I'm not opposed to this, but I can see possible a11y issues where the tile might need to be an h2 or h4. Any ideas on solving that?

awcodes avatar Jan 21 '25 04:01 awcodes

@awcodes I have one idea.

This could be solved the same way helperText is implemented where one can use HTML strings (Htmlable). For example with helperText one can do the following:

->helperText(
      str(__('The Title'))
          ->inlineMarkdown()
          ->toHtmlString()
  )

For reference, the type signature of helperText is as follows:

use Closure;
use Illuminate\Contracts\Support\Htmlable;

public function helperText(string | Htmlable | Closure | null $text): static;

MaG21 avatar Jan 21 '25 13:01 MaG21