Flash

Description

Display the typical Rails flash notification.

PRO
This component is part of our professional component suite. See the installation instructions below for more on how to use it.

Arguments

Name Default Type Description
flash Hash The Rails flash hash or any hash with the keys :notice, :alert, :info
html_attributes {} Hash Any attributes for the used html wrapper tag

Examples

Notice

<%= render Railsboot::FlashComponent.new(flash: {notice: "This is a notice flash"}) %>
  
<div class="alert alert-success alert-dismissible fade show" role="alert">
  This is a notice flash
  <button data-bs-dismiss="alert" class="btn-close" aria-label="Close"></button>
</div>

Alert

<%= render Railsboot::FlashComponent.new(flash: {alert: "This is an alert flash"}) %>
  
<div class="alert alert-danger alert-dismissible fade show" role="alert">
  This is an alert flash
  <button data-bs-dismiss="alert" class="btn-close" aria-label="Close"></button>
</div>

Info

<%= render Railsboot::FlashComponent.new(flash: {info: "This is an info flash"}) %>
  
<div class="alert alert-info alert-dismissible fade show" role="alert">
  This is an info flash
  <button data-bs-dismiss="alert" class="btn-close" aria-label="Close"></button>
</div>

Installation

Simply download this component with all its related files and assets. Unpackage the downloaded ZIP-file, copy all relevant files into your app and adapt the things you need. The ZIP-folder contains:

  • A parent component class (app/components/railsboot/component.rb) of which all components inherit from.
  • A base component class (app/components/railsboot/base_component.rb) which is used for rendering internally.
  • The desired component itself (app/components/railsboot/flash_component.rb).
  • A view template (app/components/railsboot/flash_component.html.erb) for the component unless it's rendered inline.
  • Any other dependent components such as Slots (just if the component needs those)
  • Any dependent assets (JS-Files, CSS-Files) (just if the component needs those)
  • A test file for the components (test/components/railsboot/flash_component_test.rb) including potential slot or dependency tests.

For more information please refer to the installation section.

Download

Download the component and its related files (e.g. templates, assets, slots etc.), unpackage the zip file and adapt the things you need.

Get access You need to purchase a professional license to download this component.