提示訊息 - Alert

1
2
3
4
5
6
7
8
9
10
11
12
<div class="alert alert-primary" data-alert role="alert">
  This is a primary alert—check it out!
</div>
<div class="alert alert-secondary" data-alert role="alert">
  This is a secondary alert—check it out!
</div>
<div class="alert alert-warn" data-alert role="alert">
  This is a warning alert—check it out!
</div>
<div class="alert alert-danger" data-alert role="alert">
  This is a danger alert—check it out!
</div>
1
2
3
4
5
6
7
8
9
10
11
12
<div class="alert alert-primary" data-alert role="alert">
  This is a primary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-secondary" data-alert role="alert">
  This is a secondary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-warn" data-alert role="alert">
  This is a warning alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-danger" data-alert role="alert">
  This is a danger alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
1
2
3
4
5
6
<div class="alert alert-primary" data-alert role="alert">
  <h4 class="alert-heading">Well done!</h4>
  <p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
  <hr>
  <p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
</div>
1
2
3
4
5
6
<div class="alert alert-warn alert-dismissible fade show" data-alert role="alert">
  <strong>Holy guacamole!</strong> You should check in on some of those fields below.
  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>

Rails View Helper

<%= b_alert_box("訊息內容", style: :danger, dismissible: true) %>