Display this when there is nothing to display. This prevents your users from seeing boring blank pages with one liners like "no users to display". Similar to all the other BladewindUI components, the empty state component has been kept very minimal, bearing in mind that different users have different empty state preferences. In fact, each application will have its own specific empty state requirements.
The above example uses the default empty state image that comes bundled with BladewindUI. This image is available at public > vendor > bladewind > images > empty-state.svg
.
The default image is used if you leave out the image
attribute of the Empty State component. You can use your own images by setting the
image
attribute. Bladewind searches for your file from the public
directory.
There are times you will want your empty state to have a heading to let the user know immediately what is happening, without having to read the full message.
To achieve this set the heading
attribute of the Empty State component.
The examples above use the attributes of the empty state component to build the empty state content. It is also possible to ignore all attributes and dump your content right in to the empty state component.
In this case you will need to set show_image="false"
.
You can also have empty states with no call to action buttons. For example, a "Recent Activities" section that fills up when users perform activities throughtout the app. An empty state for a case like that will necessarily need no action to be performed.
To achieve this, you should leave out the button_label
attribute or set it to an empty string.
The table below shows a comprehensive list of all the attributes available for the Empty State component.
Option | Default | Available Values |
---|---|---|
image | /vendor/bladewind/images/empty-state.svg | Image to display. |
show_image | true | Specifies whether the image should be displayed or not. Set this to false if you intend to control the entire content of the empty state component. true false |
image_size | medium | Specifies the size of the image. small medium large xl omg |
button_label | blank | Text to display on the call to action button. |
onclick | blank |
Action to perform when the call to action button is clicked. This could be a block of javascript or a function call. Example:
onclick="location.href='/dashboard'" or if you have a javascript helper function for accessing URLs you can do
onclick="goToRoute('dashboard')"
|
heading | blank | Empty state heading. |
message | blank | Empty state message. |
class | bw-empty-state | Any additional css classes can be added using this attribute. |
image_css | blank | Any additional css classes to be applied to the image. |
resources > views > components > bladewind > empty-state.blade.php