Bootstrap 5.3.8 • Chapter 56 • Responsive LTR + RTL
Bootstrap JavaScript API
Every topic includes its own Bootstrap coding example, explanation, ten teaching examples, expected result, practice, and responsive Persian/Arabic checks.
56.1 Data Attributes
Data Attributes is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax. The example uses Bootstrap classes or APIs directly so you can connect the class name to its visual or interactive result.
For Data Attributes in Chapter 56, inspect the DOM structure, Bootstrap class names, responsive breakpoint, and any data-bs attributes or JavaScript initialization. When Google Translate is active, also verify that longer labels wrap and the correct LTR or RTL Bootstrap stylesheet is enabled.
Test Data Attributes at phone, tablet, laptop, and wide-screen sizes. Then translate the example to Persian and Arabic, increase browser zoom, and inspect whether rows, columns, forms, menus, overlays, and labels remain inside the viewport.
Concept in plain language
Data Attributes is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax.
10 teaching examples
Example 1: Minimal component
Build the smallest lesson page that demonstrates Data Attributes. Keep the Bootstrap classes visible in the markup and explain which class provides the behavior. Chapter 56, topic 1, example 1.
Example 2: Responsive variation
Add a breakpoint-specific class to the admin page example for Data Attributes. Compare the mobile layout with the tablet or desktop layout. Chapter 56, topic 1, example 2.
Example 3: Long translation
Replace a short English label in the booking page with a much longer translated label while using Data Attributes. Confirm wrapping does not widen the viewport. Chapter 56, topic 1, example 3.
Example 4: Persian test
Translate the course page to Persian. Verify start/end spacing, text alignment, component direction, and that the Bootstrap RTL stylesheet is active. Chapter 56, topic 1, example 4.
Example 5: Arabic test
Translate the dashboard to Arabic. Check buttons, forms, dropdowns, navigation, and offcanvas placement for correct RTL behavior. Chapter 56, topic 1, example 5.
Example 6: Accessibility review
Use Data Attributes in the profile screen and verify semantic HTML, accessible names, keyboard interaction, focus visibility, and status messaging. Chapter 56, topic 1, example 6.
Example 7: Content stress
Add long text, nested controls, wide media, and narrow viewport width to the checkout. Adjust the Bootstrap structure without hiding meaningful content. Chapter 56, topic 1, example 7.
Example 8: Utility comparison
Rebuild one part of the contact form using Bootstrap utilities instead of custom CSS, then compare readability and maintainability. Chapter 56, topic 1, example 8.
Example 9: JavaScript-state test
If Data Attributes uses Bootstrap JavaScript, test open, close, focus, disposal, and repeated initialization in the article. If not, verify the example works without JavaScript. Chapter 56, topic 1, example 9.
Example 10: Production review
Review Data Attributes in the settings panel for breakpoints, RTL, Google Translate, zoom, keyboard use, performance, and maintainable class choices. Chapter 56, topic 1, example 10.
Bootstrap coding example
<button class="btn btn-primary" data-bs-toggle="collapse" data-bs-target="#apiPanel">Data API</button><div id="apiPanel" class="collapse">Panel</div>Step-by-step code explanation
- Identify the Bootstrap class, data attribute, or JavaScript API used for Data Attributes.
- Read the HTML nesting first. Bootstrap components often depend on a specific relationship between wrappers, controls, and content.
- Resize the viewport and observe which responsive classes become active at each breakpoint.
- Translate the visible content. Long labels must wrap, .row children must be able to shrink, and tables should use a local responsive wrapper instead of widening the page.
- Switch to Persian or Arabic and confirm that the page has dir=rtl, Bootstrap's RTL stylesheet is active, start/end utilities behave correctly, and code examples remain LTR.
Expected result: The browser demonstrates Data Attributes with responsive behavior. Persian and Arabic use RTL layout without creating page-wide horizontal scrolling; genuinely wide code or tables scroll locally.
Practice exercise
Build a new Bootstrap 5.3.8 example for Data Attributes from Chapter 56. Test it at 320px, 768px, and desktop width, translate its visible text to Persian and Arabic, and explain which Bootstrap classes or JavaScript API create the final behavior.
56.2 Programmatic Components
Programmatic Components is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax. The example uses Bootstrap classes or APIs directly so you can connect the class name to its visual or interactive result.
For Programmatic Components in Chapter 56, inspect the DOM structure, Bootstrap class names, responsive breakpoint, and any data-bs attributes or JavaScript initialization. When Google Translate is active, also verify that longer labels wrap and the correct LTR or RTL Bootstrap stylesheet is enabled.
Test Programmatic Components at phone, tablet, laptop, and wide-screen sizes. Then translate the example to Persian and Arabic, increase browser zoom, and inspect whether rows, columns, forms, menus, overlays, and labels remain inside the viewport.
Concept in plain language
Programmatic Components is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax.
10 teaching examples
Example 1: Minimal component
Build the smallest booking page that demonstrates Programmatic Components. Keep the Bootstrap classes visible in the markup and explain which class provides the behavior. Chapter 56, topic 2, example 1.
Example 2: Responsive variation
Add a breakpoint-specific class to the course page example for Programmatic Components. Compare the mobile layout with the tablet or desktop layout. Chapter 56, topic 2, example 2.
Example 3: Long translation
Replace a short English label in the dashboard with a much longer translated label while using Programmatic Components. Confirm wrapping does not widen the viewport. Chapter 56, topic 2, example 3.
Example 4: Persian test
Translate the profile screen to Persian. Verify start/end spacing, text alignment, component direction, and that the Bootstrap RTL stylesheet is active. Chapter 56, topic 2, example 4.
Example 5: Arabic test
Translate the checkout to Arabic. Check buttons, forms, dropdowns, navigation, and offcanvas placement for correct RTL behavior. Chapter 56, topic 2, example 5.
Example 6: Accessibility review
Use Programmatic Components in the contact form and verify semantic HTML, accessible names, keyboard interaction, focus visibility, and status messaging. Chapter 56, topic 2, example 6.
Example 7: Content stress
Add long text, nested controls, wide media, and narrow viewport width to the article. Adjust the Bootstrap structure without hiding meaningful content. Chapter 56, topic 2, example 7.
Example 8: Utility comparison
Rebuild one part of the settings panel using Bootstrap utilities instead of custom CSS, then compare readability and maintainability. Chapter 56, topic 2, example 8.
Example 9: JavaScript-state test
If Programmatic Components uses Bootstrap JavaScript, test open, close, focus, disposal, and repeated initialization in the gallery. If not, verify the example works without JavaScript. Chapter 56, topic 2, example 9.
Example 10: Production review
Review Programmatic Components in the support page for breakpoints, RTL, Google Translate, zoom, keyboard use, performance, and maintainable class choices. Chapter 56, topic 2, example 10.
Bootstrap coding example
<div id="apiModal" class="modal" tabindex="-1"><div class="modal-dialog"><div class="modal-content"><div class="modal-body">Modal</div></div></div></div><script>new bootstrap.Modal(document.getElementById("apiModal")).show()</script>Step-by-step code explanation
- Identify the Bootstrap class, data attribute, or JavaScript API used for Programmatic Components.
- Read the HTML nesting first. Bootstrap components often depend on a specific relationship between wrappers, controls, and content.
- Resize the viewport and observe which responsive classes become active at each breakpoint.
- Translate the visible content. Long labels must wrap, .row children must be able to shrink, and tables should use a local responsive wrapper instead of widening the page.
- Switch to Persian or Arabic and confirm that the page has dir=rtl, Bootstrap's RTL stylesheet is active, start/end utilities behave correctly, and code examples remain LTR.
Expected result: The browser demonstrates Programmatic Components with responsive behavior. Persian and Arabic use RTL layout without creating page-wide horizontal scrolling; genuinely wide code or tables scroll locally.
Practice exercise
Build a new Bootstrap 5.3.8 example for Programmatic Components from Chapter 56. Test it at 320px, 768px, and desktop width, translate its visible text to Persian and Arabic, and explain which Bootstrap classes or JavaScript API create the final behavior.
56.3 Events
Events is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax. The example uses Bootstrap classes or APIs directly so you can connect the class name to its visual or interactive result.
For Events in Chapter 56, inspect the DOM structure, Bootstrap class names, responsive breakpoint, and any data-bs attributes or JavaScript initialization. When Google Translate is active, also verify that longer labels wrap and the correct LTR or RTL Bootstrap stylesheet is enabled.
Test Events at phone, tablet, laptop, and wide-screen sizes. Then translate the example to Persian and Arabic, increase browser zoom, and inspect whether rows, columns, forms, menus, overlays, and labels remain inside the viewport.
Concept in plain language
Events is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax.
10 teaching examples
Example 1: Minimal component
Build the smallest dashboard that demonstrates Events. Keep the Bootstrap classes visible in the markup and explain which class provides the behavior. Chapter 56, topic 3, example 1.
Example 2: Responsive variation
Add a breakpoint-specific class to the profile screen example for Events. Compare the mobile layout with the tablet or desktop layout. Chapter 56, topic 3, example 2.
Example 3: Long translation
Replace a short English label in the checkout with a much longer translated label while using Events. Confirm wrapping does not widen the viewport. Chapter 56, topic 3, example 3.
Example 4: Persian test
Translate the contact form to Persian. Verify start/end spacing, text alignment, component direction, and that the Bootstrap RTL stylesheet is active. Chapter 56, topic 3, example 4.
Example 5: Arabic test
Translate the article to Arabic. Check buttons, forms, dropdowns, navigation, and offcanvas placement for correct RTL behavior. Chapter 56, topic 3, example 5.
Example 6: Accessibility review
Use Events in the settings panel and verify semantic HTML, accessible names, keyboard interaction, focus visibility, and status messaging. Chapter 56, topic 3, example 6.
Example 7: Content stress
Add long text, nested controls, wide media, and narrow viewport width to the gallery. Adjust the Bootstrap structure without hiding meaningful content. Chapter 56, topic 3, example 7.
Example 8: Utility comparison
Rebuild one part of the support page using Bootstrap utilities instead of custom CSS, then compare readability and maintainability. Chapter 56, topic 3, example 8.
Example 9: JavaScript-state test
If Events uses Bootstrap JavaScript, test open, close, focus, disposal, and repeated initialization in the event page. If not, verify the example works without JavaScript. Chapter 56, topic 3, example 9.
Example 10: Production review
Review Events in the analytics page for breakpoints, RTL, Google Translate, zoom, keyboard use, performance, and maintainable class choices. Chapter 56, topic 3, example 10.
Bootstrap coding example
<div id="eventModal" class="modal" tabindex="-1"></div><script>eventModal.addEventListener("shown.bs.modal",()=>console.log("shown"))</script>Step-by-step code explanation
- Identify the Bootstrap class, data attribute, or JavaScript API used for Events.
- Read the HTML nesting first. Bootstrap components often depend on a specific relationship between wrappers, controls, and content.
- Resize the viewport and observe which responsive classes become active at each breakpoint.
- Translate the visible content. Long labels must wrap, .row children must be able to shrink, and tables should use a local responsive wrapper instead of widening the page.
- Switch to Persian or Arabic and confirm that the page has dir=rtl, Bootstrap's RTL stylesheet is active, start/end utilities behave correctly, and code examples remain LTR.
Expected result: The browser demonstrates Events with responsive behavior. Persian and Arabic use RTL layout without creating page-wide horizontal scrolling; genuinely wide code or tables scroll locally.
Practice exercise
Build a new Bootstrap 5.3.8 example for Events from Chapter 56. Test it at 320px, 768px, and desktop width, translate its visible text to Persian and Arabic, and explain which Bootstrap classes or JavaScript API create the final behavior.
56.4 getInstance and getOrCreateInstance
getInstance and getOrCreateInstance is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax. The example uses Bootstrap classes or APIs directly so you can connect the class name to its visual or interactive result.
For getInstance and getOrCreateInstance in Chapter 56, inspect the DOM structure, Bootstrap class names, responsive breakpoint, and any data-bs attributes or JavaScript initialization. When Google Translate is active, also verify that longer labels wrap and the correct LTR or RTL Bootstrap stylesheet is enabled.
Test getInstance and getOrCreateInstance at phone, tablet, laptop, and wide-screen sizes. Then translate the example to Persian and Arabic, increase browser zoom, and inspect whether rows, columns, forms, menus, overlays, and labels remain inside the viewport.
Concept in plain language
getInstance and getOrCreateInstance is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax.
10 teaching examples
Example 1: Minimal component
Build the smallest checkout that demonstrates getInstance and getOrCreateInstance. Keep the Bootstrap classes visible in the markup and explain which class provides the behavior. Chapter 56, topic 4, example 1.
Example 2: Responsive variation
Add a breakpoint-specific class to the contact form example for getInstance and getOrCreateInstance. Compare the mobile layout with the tablet or desktop layout. Chapter 56, topic 4, example 2.
Example 3: Long translation
Replace a short English label in the article with a much longer translated label while using getInstance and getOrCreateInstance. Confirm wrapping does not widen the viewport. Chapter 56, topic 4, example 3.
Example 4: Persian test
Translate the settings panel to Persian. Verify start/end spacing, text alignment, component direction, and that the Bootstrap RTL stylesheet is active. Chapter 56, topic 4, example 4.
Example 5: Arabic test
Translate the gallery to Arabic. Check buttons, forms, dropdowns, navigation, and offcanvas placement for correct RTL behavior. Chapter 56, topic 4, example 5.
Example 6: Accessibility review
Use getInstance and getOrCreateInstance in the support page and verify semantic HTML, accessible names, keyboard interaction, focus visibility, and status messaging. Chapter 56, topic 4, example 6.
Example 7: Content stress
Add long text, nested controls, wide media, and narrow viewport width to the event page. Adjust the Bootstrap structure without hiding meaningful content. Chapter 56, topic 4, example 7.
Example 8: Utility comparison
Rebuild one part of the analytics page using Bootstrap utilities instead of custom CSS, then compare readability and maintainability. Chapter 56, topic 4, example 8.
Example 9: JavaScript-state test
If getInstance and getOrCreateInstance uses Bootstrap JavaScript, test open, close, focus, disposal, and repeated initialization in the account page. If not, verify the example works without JavaScript. Chapter 56, topic 4, example 9.
Example 10: Production review
Review getInstance and getOrCreateInstance in the lesson page for breakpoints, RTL, Google Translate, zoom, keyboard use, performance, and maintainable class choices. Chapter 56, topic 4, example 10.
Bootstrap coding example
<div id="tipTarget" title="Tip"></div><script>const tip=bootstrap.Tooltip.getOrCreateInstance(document.getElementById("tipTarget"))</script>Step-by-step code explanation
- Identify the Bootstrap class, data attribute, or JavaScript API used for getInstance and getOrCreateInstance.
- Read the HTML nesting first. Bootstrap components often depend on a specific relationship between wrappers, controls, and content.
- Resize the viewport and observe which responsive classes become active at each breakpoint.
- Translate the visible content. Long labels must wrap, .row children must be able to shrink, and tables should use a local responsive wrapper instead of widening the page.
- Switch to Persian or Arabic and confirm that the page has dir=rtl, Bootstrap's RTL stylesheet is active, start/end utilities behave correctly, and code examples remain LTR.
Expected result: The browser demonstrates getInstance and getOrCreateInstance with responsive behavior. Persian and Arabic use RTL layout without creating page-wide horizontal scrolling; genuinely wide code or tables scroll locally.
Practice exercise
Build a new Bootstrap 5.3.8 example for getInstance and getOrCreateInstance from Chapter 56. Test it at 320px, 768px, and desktop width, translate its visible text to Persian and Arabic, and explain which Bootstrap classes or JavaScript API create the final behavior.
56.5 Dispose Methods
Dispose Methods is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax. The example uses Bootstrap classes or APIs directly so you can connect the class name to its visual or interactive result.
For Dispose Methods in Chapter 56, inspect the DOM structure, Bootstrap class names, responsive breakpoint, and any data-bs attributes or JavaScript initialization. When Google Translate is active, also verify that longer labels wrap and the correct LTR or RTL Bootstrap stylesheet is enabled.
Test Dispose Methods at phone, tablet, laptop, and wide-screen sizes. Then translate the example to Persian and Arabic, increase browser zoom, and inspect whether rows, columns, forms, menus, overlays, and labels remain inside the viewport.
Concept in plain language
Dispose Methods is part of Bootstrap 5.3.8 covered in Chapter 56. Read the Bootstrap class names as a layer over CSS layout, spacing, components, utilities, and JavaScript behavior rather than as magic syntax.
10 teaching examples
Example 1: Minimal component
Build the smallest article that demonstrates Dispose Methods. Keep the Bootstrap classes visible in the markup and explain which class provides the behavior. Chapter 56, topic 5, example 1.
Example 2: Responsive variation
Add a breakpoint-specific class to the settings panel example for Dispose Methods. Compare the mobile layout with the tablet or desktop layout. Chapter 56, topic 5, example 2.
Example 3: Long translation
Replace a short English label in the gallery with a much longer translated label while using Dispose Methods. Confirm wrapping does not widen the viewport. Chapter 56, topic 5, example 3.
Example 4: Persian test
Translate the support page to Persian. Verify start/end spacing, text alignment, component direction, and that the Bootstrap RTL stylesheet is active. Chapter 56, topic 5, example 4.
Example 5: Arabic test
Translate the event page to Arabic. Check buttons, forms, dropdowns, navigation, and offcanvas placement for correct RTL behavior. Chapter 56, topic 5, example 5.
Example 6: Accessibility review
Use Dispose Methods in the analytics page and verify semantic HTML, accessible names, keyboard interaction, focus visibility, and status messaging. Chapter 56, topic 5, example 6.
Example 7: Content stress
Add long text, nested controls, wide media, and narrow viewport width to the account page. Adjust the Bootstrap structure without hiding meaningful content. Chapter 56, topic 5, example 7.
Example 8: Utility comparison
Rebuild one part of the lesson page using Bootstrap utilities instead of custom CSS, then compare readability and maintainability. Chapter 56, topic 5, example 8.
Example 9: JavaScript-state test
If Dispose Methods uses Bootstrap JavaScript, test open, close, focus, disposal, and repeated initialization in the admin page. If not, verify the example works without JavaScript. Chapter 56, topic 5, example 9.
Example 10: Production review
Review Dispose Methods in the booking page for breakpoints, RTL, Google Translate, zoom, keyboard use, performance, and maintainable class choices. Chapter 56, topic 5, example 10.
Bootstrap coding example
<div id="disposeTip" title="Tip"></div><script>const tip=bootstrap.Tooltip.getOrCreateInstance(document.getElementById("disposeTip"));tip.dispose()</script>Step-by-step code explanation
- Identify the Bootstrap class, data attribute, or JavaScript API used for Dispose Methods.
- Read the HTML nesting first. Bootstrap components often depend on a specific relationship between wrappers, controls, and content.
- Resize the viewport and observe which responsive classes become active at each breakpoint.
- Translate the visible content. Long labels must wrap, .row children must be able to shrink, and tables should use a local responsive wrapper instead of widening the page.
- Switch to Persian or Arabic and confirm that the page has dir=rtl, Bootstrap's RTL stylesheet is active, start/end utilities behave correctly, and code examples remain LTR.
Expected result: The browser demonstrates Dispose Methods with responsive behavior. Persian and Arabic use RTL layout without creating page-wide horizontal scrolling; genuinely wide code or tables scroll locally.
Practice exercise
Build a new Bootstrap 5.3.8 example for Dispose Methods from Chapter 56. Test it at 320px, 768px, and desktop width, translate its visible text to Persian and Arabic, and explain which Bootstrap classes or JavaScript API create the final behavior.
Chapter 56 review — 10 questions and answers
1. What should you inspect when Data Attributes does not behave as expected?
Answer: Check the Bootstrap classes, breakpoint, DOM structure, loaded CSS version, and any JavaScript data attributes involved in Data Attributes. Then inspect computed styles to see which declaration wins.
2. How should Data Attributes be tested before publishing?
Answer: Test Data Attributes on narrow and wide screens, with long translated text, in Persian and Arabic RTL mode, at increased zoom, and with keyboard navigation where the component is interactive.
3. What should you inspect when Programmatic Components does not behave as expected?
Answer: Check the Bootstrap classes, breakpoint, DOM structure, loaded CSS version, and any JavaScript data attributes involved in Programmatic Components. Then inspect computed styles to see which declaration wins.
4. How should Programmatic Components be tested before publishing?
Answer: Test Programmatic Components on narrow and wide screens, with long translated text, in Persian and Arabic RTL mode, at increased zoom, and with keyboard navigation where the component is interactive.
5. What should you inspect when Events does not behave as expected?
Answer: Check the Bootstrap classes, breakpoint, DOM structure, loaded CSS version, and any JavaScript data attributes involved in Events. Then inspect computed styles to see which declaration wins.
6. How should Events be tested before publishing?
Answer: Test Events on narrow and wide screens, with long translated text, in Persian and Arabic RTL mode, at increased zoom, and with keyboard navigation where the component is interactive.
7. What should you inspect when getInstance and getOrCreateInstance does not behave as expected?
Answer: Check the Bootstrap classes, breakpoint, DOM structure, loaded CSS version, and any JavaScript data attributes involved in getInstance and getOrCreateInstance. Then inspect computed styles to see which declaration wins.
8. How should getInstance and getOrCreateInstance be tested before publishing?
Answer: Test getInstance and getOrCreateInstance on narrow and wide screens, with long translated text, in Persian and Arabic RTL mode, at increased zoom, and with keyboard navigation where the component is interactive.
9. What should you inspect when Dispose Methods does not behave as expected?
Answer: Check the Bootstrap classes, breakpoint, DOM structure, loaded CSS version, and any JavaScript data attributes involved in Dispose Methods. Then inspect computed styles to see which declaration wins.
10. How should Dispose Methods be tested before publishing?
Answer: Test Dispose Methods on narrow and wide screens, with long translated text, in Persian and Arabic RTL mode, at increased zoom, and with keyboard navigation where the component is interactive.