Guide
Configuration
The config file, the translations and how to replace a component's view with your own.
Config file
Publish the config file to change the defaults:
Nothing to show
| Key | Default | What it controls |
|---|---|---|
inject_assets |
'auto' |
Where the script tag is injected: 'auto' on pages that render a component or a Livewire component, true on every HTML page, false never (use @tallkitScripts). See Scripts. |
load_alpine |
true |
Whether the script loads Alpine.js when the page has none. |
cache_classes |
true |
Caches merged Tailwind class lists between requests. |
blaze |
true |
With Blaze installed, compiles the package's components with it. false keeps them on plain Blade. |
colors |
[] |
Your own color names, each a .tallkit-color-{name} class you define (Colors). |
defaults |
[] |
Attributes every use of a component gets, as if written on its tag, keyed by the tag without tk: ('section' => ['icon:class' => 'text-blue-400'], 'table.column' => [...]). What the tag writes wins; for class, both are kept and the tag's wins a conflict. Components the package renders inside others get them too. |
avatar.unavatar |
false |
Looks avatars up on unavatar.io, sending the email or username to that service. false shows only URLs as images. |
address.lookup |
true |
Zipcode lookup from the browser through viacep.com.br and brasilapi.com.br. A URL of your own with {zipcode} replaces them; an array sets the lookup options (Address); false turns it off. |
masks |
a pt_BR set |
Input masks applied by field name, per app locale. |
tooltip |
Default delay, position, alignment, arrow, variant and size of tooltips. | |
icon |
Whether icons missing locally are fetched from Iconify after the response (fetch), the collections tried for a name without one, and how long a missing icon is remembered. |
|
upload |
Uploads: the disk, allowed extensions and sizes of tk:upload and TALLKit::uploadRules(), the extra disks a field may name (allowed_disks), extensions added to a kind or kinds of your own (file_types), and the editors' uploads (enabled, route, middleware, guard, directory, the link lifetimes url_ttl and guest_url_ttl, and what a guest link takes, guest_types and guest_max_size); also Livewire's upload limit (Upload). |
Never add svg, html or js to upload.allowed_extensions or upload.file_types: served from your domain, those files run scripts (stored XSS).
Privacy
address.lookup sends the zipcode to third parties by default, and avatar.unavatar, when turned on, sends the email or username; leave them off if that does not fit your privacy policy.
Editor uploads
The editors' uploads go to the public disk by default: run php artisan storage:link so their URLs work, or set upload.disk to a disk with a public URL.
upload.enabled (true) turns the upload route off when false, and the editors keep files inline. upload.middleware defaults to ['web', 'throttle:tallkit.uploads'], 60 uploads per minute per user (or IP); without the throttle there is no limit. upload.guard (null: the default guard) is the guard a signed link is checked against. upload.livewire_max_size (true) raises Livewire's temporary upload limit to the largest upload.max_size, at least Livewire's own 12 MB, unless the app sets livewire.temporary_file_upload.rules.
Blaze
livewire/blaze compiles Blade components into plain PHP functions, which render faster. It is not a dependency of the package: install it in your app and the package's components use it, keeping the <tk:...> tags and the same HTML.
Nothing to show
Measured with Blaze 1.0 on the usage example of each component, with warm caches: 1.6 times faster at the median, from 1.1 to 2.3 times (tk:button renders in 0.112 ms instead of 0.161 ms). tk:stepper and tk:field.group stay on plain Blade, since their children find them in Blade's component stack; their children still use Blaze. The views compiled before are cleared once when Blaze is installed, removed or turned off with blaze => false. Views you override in resources/views/tallkit/ stay on Blade unless you add that folder to Blaze yourself.
Translations
The texts are English JSON translation keys, and the package ships a pt_BR translation. Add a locale, or change any text, in your app's lang/{locale}.json: its keys take precedence over the package's.
The labels, placeholders and other texts you pass to the components are translated the same way, through TALLKit::translate(). A text that is also the name of one of your translation files (Pagination, Validation) is shown as written, instead of that file's array.
Customizing the views
A view placed in resources/views/tallkit/, mirroring the path it has in the package's resources/views/, replaces the package's version of that component. The folder is looked for when the app boots, so restart long-running processes (Octane, queue workers) after creating it. A copied view no longer gets the fixes of package updates; compare it with the package's version when you update.