@@ -19,150 +19,38 @@ You may publish the config file via:
1919php artisan fc:publish
2020```
2121
22- This is the default configuration:
22+ [ Click here ] ( https://github.com/rawilk/laravel-form-components/blob/master/config/form-components.php ) to view the default configuration.
2323
24- ``` php
25- use Rawilk\FormComponents\Components;
24+ ## Directives
2625
27- return [
28- /*
29- |--------------------------------------------------------------------------
30- | Components
31- |--------------------------------------------------------------------------
32- |
33- | Below you reference all form components that should be loaded for your
34- | app. By default all components from laravel-form-components are loaded
35- | in. You can disable or overwrite any component class or alias that
36- | you want.
37- |
38- */
39- 'components' => [
40-
41- 'form' => [
42- 'class' => Components\Form::class,
43- 'view' => 'form-components::components.form',
44- ],
45-
46- 'input' => [
47- 'class' => Components\Inputs\Input::class,
48- 'view' => 'form-components::components.inputs.input',
49- ],
50-
51- 'email' => [
52- 'class' => Components\Inputs\Email::class,
53- 'view' => 'form-components::components.inputs.input',
54- ],
55-
56- 'password' => [
57- 'class' => Components\Inputs\Password::class,
58- 'view' => 'form-components::components.inputs.password',
59-
60- /*
61- * This icon will show when the password is masked and show toggle is enabled.
62- * Can be overridden individually as well.
63- */
64- 'show_password_icon' => 'heroicon-s-eye',
65-
66- /*
67- * This icon will show when the password is un-masked and show toggle is enabled.
68- * Can be overridden individually as well.
69- */
70- 'hide_password_icon' => 'heroicon-o-eye-off',
71- ],
72-
73- 'textarea' => [
74- 'class' => Components\Inputs\Textarea::class,
75- 'view' => 'form-components::components.inputs.textarea',
76- ],
77-
78- 'checkbox' => [
79- 'class' => Components\Choice\Checkbox::class,
80- 'view' => 'form-components::components.choice.checkbox-or-radio',
81- ],
82-
83- 'radio' => [
84- 'class' => Components\Choice\Radio::class,
85- 'view' => 'form-components::components.choice.checkbox-or-radio',
86- ],
87-
88- 'select' => [
89- 'class' => Components\Inputs\Select::class,
90- 'view' => 'form-components::components.inputs.select',
91- ],
92-
93- 'label' => [
94- 'class' => Components\Label::class,
95- 'view' => 'form-components::components.label',
96- ],
97-
98- 'checkbox-group' => [
99- 'class' => Components\Choice\CheckboxGroup::class,
100- 'view' => 'form-components::components.choice.checkbox-group',
101- ],
102-
103- 'form-group' => [
104- 'class' => Components\FormGroup::class,
105- 'view' => 'form-components::components.form-group',
106- ],
107-
108- 'form-error' => [
109- 'class' => Components\FormError::class,
110- 'view' => 'form-components::components.form-error',
111- ],
112-
113- 'timezone-select' => [
114- 'class' => Components\Inputs\TimezoneSelect::class,
115- 'view' => 'form-components::components.inputs.timezone-select',
116- ],
117-
118- ],
119-
120- /*
121- |--------------------------------------------------------------------------
122- | Prefix
123- |--------------------------------------------------------------------------
124- |
125- | This value will set a prefix for all laravel-form-components blade
126- | components. By default it's empty. This is useful if you want to avoid
127- | collision with components from other libraries.
128- |
129- | If set with "tw", for example, you can reference components like:
130- |
131- | <x-tw-form />
132- |
133- */
134- 'prefix' => '',
135-
136- /*
137- |--------------------------------------------------------------------------
138- | Enable Timezone Select
139- |--------------------------------------------------------------------------
140- |
141- | If you don't plan on using a timezone select in your app, you can disable
142- | it here. This will prevent the use of app('fc-timezone'). You should also
143- | remove the "timezone-select" from the registered components in the config
144- | as well.
145- |
146- */
147- 'enable_timezone' => true,
148-
149- /*
150- |--------------------------------------------------------------------------
151- | Default Timezone Subset
152- |--------------------------------------------------------------------------
153- |
154- | You may not always need the full list of timezones to choose from,
155- | so you may define a subset of regions to pull from instead. Set
156- | the value to `false` to use all regions.
157- |
158- | Example: [\Rawilk\FormComponents\Support\TimezoneRegion::AMERICA]
159- |
160- */
161- 'timezone_subset' => false,
26+ One of the biggest advantages to ` laravel-form-components ` is that almost all of its components come ready
27+ out-of-the-box. To achieve this, Laravel Form Components makes use of CDNs from
28+ any 3rd party library that a component might need. To make sure these CDNs are
29+ included in your HTML, you can make use of the ` @fcStyles ` and ` @fcScripts ` directives.
16230
163- ];
31+ Place the ` @fcStyles ` in the ` <head> ` before any of your other styles. Place the ` @fcScripts ` directive right before
32+ your closing ` </body> ` tag and ** after** scripts from libraries like Livewire.
33+
34+ ** Note:** The ` @fcStyles ` directives ** does not** include styles generated by Laravel Form Components. You will still need to include
35+ those in [ a stylesheet manually] ( #styling ) .
36+
37+ ## Production
38+
39+ Even though these directives allow you to get up and running with the components quickly, ** we recommend that you compile the 3rd
40+ party libraries that each component needs through an asset pipeline** (like [ Laravel Mix] ( https://github.com/JeffreyWay/laravel-mix ) ).
41+ By default, when your ` app.debug ` config option is disabled, the directives are also disabled for performance reasons.
42+
43+ If you always want these directives to be executed, even when ` app.debug ` is disabled, you can force them to load the CDN
44+ links by passing a ` true ` boolean:
45+
46+ ``` html
47+ @fcStyles(true)
48+ @fcScripts(true)
16449```
16550
51+ Libraries are only loaded for components that are enabled through the ` components ` config option. You can learn more about
52+ [ disabling specific components] ( #components ) below.
53+
16654## Views
16755
16856You may override the views, either by using your own views and specifying them in the config, or by publishing the package's views:
0 commit comments