Skip to content
Learn Netverks

Lesson

Step 29/36 81% through track

modals-toasts

Modals and toasts

Last reviewed Jun 1, 2026 Content v20260601
Track mode
iframe_html
Means
HTML preview sandbox
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches Modals and toasts—the ideas, syntax, and habits you need before moving on in Bootstrap.

Bootstrap patterns appear constantly in legacy apps and rapid admin UI work.

You will apply Modals and toasts in contexts like: Internal tools, WordPress themes, Laravel apps, and teams that want opinionated UI without writing every rule from scratch.

Read the lesson, edit HTML/CSS in the playground, press Run to preview, then answer the lesson MCQs.

Toward the end of the track—use it to consolidate patterns before the capstone or summary lessons.

Modals capture attention for confirmations, forms, or detail views. Markup lives at the end of <body>: modalmodal-dialogmodal-content with header, body, and footer sections. Open via data-bs-toggle="modal" and data-bs-target="#id".

Toasts for lightweight feedback

Toasts are non-blocking notifications. Place them in a toast-container (often top-end fixed). Trigger with JavaScript or Bootstrap’s toast API after form success—avoid stacking too many at once.

Focus management

Modals trap focus and add a backdrop. Always provide a close control and a clear primary action. For destructive flows, use btn-danger on confirm and keep cancel as the safe default focus where possible.

Self-check

  1. Which element wraps the visible dialog box?
  2. How do you open a modal from a button without writing JS?
  3. When is a toast better than a modal?

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • modal vs offcanvas—when each?
  • How prevent focus trap bugs?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump