I did look at this, using the current AI to generate guides.
I felt they were very technical and clinical but i think could be tweaked to add a "more human touch"
Here is an example, i asked for docs on a dynamic collapse:
Dynamic Collapsible Elements in App Connect
Overview
App Connect provides a powerful way to create dynamic collapsible elements using the dmx-collapse
component. These elements can be used to show and hide content dynamically, creating interactive and space-efficient user interfaces.
Basic Structure
HTML Structure
<div is="dmx-collapse" id="myCollapse">
<!-- Collapsible content goes here -->
<div class="collapse-content">
Your content here
</div>
</div>
Trigger Elements
<button class="btn btn-primary" dmx-on:click="myCollapse.toggle()">Toggle</button>
<!-- or -->
<button class="btn btn-primary" dmx-on:click="myCollapse.show()">Show</button>
<button class="btn btn-primary" dmx-on:click="myCollapse.hide()">Hide</button>
Methods
- toggle(): Toggles the visibility of the collapse
- show(): Expands the collapse
- hide(): Collapses the element
- isVisible(): Returns true if the collapse is visible
Properties
- duration: Animation duration in milliseconds (default: 350)
- horizontal: Enable horizontal collapse animation (default: false)
Events
- show.bs.collapse: Fires when collapse starts showing
- shown.bs.collapse: Fires when collapse is fully shown
- hide.bs.collapse: Fires when collapse starts hiding
- hidden.bs.collapse: Fires when collapse is fully hidden
Usage Examples
Basic Collapse
<button class="btn btn-primary" dmx-on:click="collapse1.toggle()">
Toggle Content
</button>
<div is="dmx-collapse" id="collapse1" class="mt-3">
<div class="card card-body">
This is collapsible content that can be toggled.
</div>
</div>
Accordion-Style Collapse
<div class="accordion">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" dmx-on:click="collapse1.toggle()">
Section 1
</button>
</h2>
<div is="dmx-collapse" id="collapse1">
<div class="accordion-body">
Content for section 1
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" dmx-on:click="collapse2.toggle()">
Section 2
</button>
</h2>
<div is="dmx-collapse" id="collapse2">
<div class="accordion-body">
Content for section 2
</div>
</div>
</div>
</div>
Conditional Collapse
<div is="dmx-collapse" id="errorCollapse"
dmx-bind:show="form1.invalid">
<div class="alert alert-danger">
Please fix the form errors
</div>
</div>
Event Handling
Responding to Collapse Events
<div is="dmx-collapse" id="collapse1"
dmx-on:shown.bs.collapse="app.notify('Content shown!')"
dmx-on:hidden.bs.collapse="app.notify('Content hidden!')">
<!-- content -->
</div>
Chaining Collapses
<div is="dmx-collapse" id="step1">
<div class="card card-body">
Step 1 content
<button class="btn btn-primary"
dmx-on:click="step1.hide();step2.show()">
Next Step
</button>
</div>
</div>
<div is="dmx-collapse" id="step2">
<div class="card card-body">
Step 2 content
</div>
</div>
Best Practices
- Unique IDs: Always use unique IDs for collapse elements
- Accessibility: Include aria-expanded and aria-controls attributes
- Animation: Keep animations short for better UX
- Content Loading: Pre-load content when possible
- Mobile Consideration: Ensure touch targets are large enough
Integration with Other Components
With Repeaters
<div dmx-repeat:item="dataSet">
<button dmx-on:click="collapse{{$index}}.toggle()">
{{item.title}}
</button>
<div is="dmx-collapse" id="collapse{{$index}}">
{{item.content}}
</div>
</div>
With Forms
<form is="dmx-serverconnect-form" method="post">
<div is="dmx-collapse" id="advancedOptions">
<!-- Advanced form fields -->
</div>
<button type="button"
dmx-on:click="advancedOptions.toggle()">
Show Advanced Options
</button>
</form>
Troubleshooting
-
Collapse Not Working
- Verify unique IDs
- Check JavaScript console for errors
- Ensure proper dmx-collapse syntax
-
Animation Issues
- Check CSS conflicts
- Verify Bootstrap inclusion
- Check duration setting
-
Content Flash
- Use initial state classes
- Pre-load content when possible
Remember to always test your collapsible elements across different devices and screen sizes to ensure consistent behavior.