apply-responsive-layout

Wraps HTML fragments into responsive mobile-first layouts using Tailwind CSS and HTMX.

1|2|Updated Nov 25, 2017
One-click install
npx skills add https://github.com/asarchami/dotfiles --skill apply-responsive-layout-asarchami
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: apply-responsive-layout
Source: https://github.com/asarchami/dotfiles/tree/main/dot_config/opencode/skills/ui_skills/apply-responsive-layout
Command: npx skills add https://github.com/asarchami/dotfiles --skill apply-responsive-layout-asarchami

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Standalone HTML fragments often break or misalign when viewed across mobile and desktop viewports, and wiring navigation, history, and partial page updates by hand is error-prone. This Skill structures page fragments into a consistent responsive layout shell with correct HTMX behavior. ## Core Features & Use Cases - Responsive Layout Wrapping: Structures content with CSS Grid and Flexbox utilities from Tailwind CSS, adapting from small mobile screens to ultra-wide desktop monitors. - Persistent Navigation: Implements sticky navigation patterns, using a bottom bar on mobile and a sidebar or top bar on desktop. - HTMX History and Swaps: Applies hx-push-url, hx-replace-url, hx-history-elt, hx-target, and hx-select-oob so fragment swaps update the right regions without breaking browser history. - Use Case: When building a new dashboard view, use this Skill to wrap the content fragment in a layout where the server returns only content fragments while navigation and sidebars stay intact. ## Quick Start Wrap my dashboard HTML fragment into a responsive layout with a mobile bottom bar and desktop sidebar using HTMX fragment swaps.

Frequently Asked Questions about apply-responsive-layout

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make an HTML fragment responsive for mobile and desktop?

Wrap the fragment in a layout built with Tailwind CSS Grid and Flexbox utilities, using a mobile-first approach. Pair it with a sticky bottom navigation bar on mobile and a sidebar or top bar on desktop so the structure adapts across viewport sizes.

How to preserve browser history with HTMX navigation?

Use hx-push-url on navigation links and pagination so each swap creates a history entry, and hx-history-elt to define which element tracks scroll position. For soft URL updates that should not create entries, use hx-replace-url instead.

Which HTMX swap strategy should I use for layout regions?

Use innerHTML for content areas, outerHTML for navigation items, and beforeend for feed or list appends. Combine hx-target with layout-specific selectors so swaps replace content regions without disrupting headers, nav, or sidebars.

Can HTMX update multiple page regions from one response?

Yes, use hx-select-oob for out-of-band swaps to update multiple regions, such as refreshing both the content pane and sidebar state from a single server response. The server should return only fragments, never the full layout wrapper.

Why does my HTMX page reload the full layout on every request?

This happens when the server returns the full layout wrapper instead of only the content fragment, which is a known anti-pattern. Configure the server to detect HTMX requests and respond with just the targeted fragment.