--- name: polaris-compositions description: Polaris composition patterns and page templates for common Shopify app layouts. Provides index tables, settings pages, dashboards, and resource management patterns. Auto-invoked when building page layouts. allowed-tools: [Read, Grep, Glob] documentation_path: ../../../polaris-web-components/patterns --- # Polaris Compositions Skill ## Purpose Provides complete page templates and composition patterns for common Shopify app layouts using Polaris Web Components. ## When This Skill Activates - Creating new pages or views - Building index/list pages - Implementing settings interfaces - Designing dashboards - Creating resource management UIs ## Available Patterns Reference: `polaris-web-components/patterns/compositions/` ### Composition Patterns 1. **App Card** - Application summary cards with actions 2. **Resource List** - Filterable, sortable resource lists 3. **Settings** - Settings page layouts with sections 4. **Callout Card** - Promotional or informational cards 5. **Account Connection** - Third-party service integrations 6. **Details** - Detailed information displays 7. **Index Table** - Data tables with bulk actions 8. **Metrics Card** - Statistics and KPI displays 9. **Setup Guide** - Onboarding checklists 10. **Homepage** - App homepage/dashboard layouts 11. **Sticky Pagination** - Persistent pagination controls 12. **Interstitial Nav** - Multi-step navigation flows 13. **Footer Help** - Contextual help sections 14. **Media Card** - Rich media content cards 15. **Empty State** - No content placeholders ## Complete Page Templates ### Index/List Page Template **Use for**: Products, Orders, Customers, Collections ```tsx {/* Stats Cards */} Total Products {stats.total} Active {stats.active} +12% Draft {stats.draft} {/* Filters */} {/* Data Table */} {products.length === 0 ? ( Try adjusting your filters or add a new product Add Product ) : ( Product Status Inventory Price Actions {products.map(product => ( {product.title} {product.active ? "Active" : "Draft"} {product.inventory} in stock ${product.price} Edit Delete ))} {/* Pagination */} Previous Page {page} of {totalPages} Next )} ``` ### Settings Page Template ```tsx {/* General Settings */} General {/* Notifications */} Notifications Choose which notifications you want to receive {/* Advanced Settings */} Advanced These settings can affect your store's functionality. Change with caution. {/* Save Section */} Reset to Defaults Save Settings ``` ### Dashboard/Homepage Template ```tsx {/* Welcome Message */} Welcome back! You have 3 orders to fulfill and 2 customer messages. {/* Key Metrics */} Today's Sales $2,453 +15% from yesterday Orders 34 5 pending Conversion Rate 3.2% +0.3% Average Order $72.15 -2% {/* Quick Actions */} Orders 5 orders need fulfillment Manage Orders Products 3 products low in stock View Inventory Customers 2 messages waiting View Messages {/* Recent Activity */} Recent Orders Order Customer Total Status {recentOrders.map(order => ( #{order.number} {order.customer} ${order.total} {order.fulfilled ? "Fulfilled" : "Pending"} ))} ``` ## Pattern Components Reference For detailed pattern documentation, see: - `polaris-web-components/patterns/compositions/` - All composition patterns - `polaris-web-components/patterns/templates/` - Complete page templates ### Quick Pattern Reference | Pattern | File | Use Case | |---------|------|----------| | Index Table | `index-table.md` | Product lists, order lists | | Settings | `settings.md` | App configuration pages | | Homepage | `homepage.md` | Dashboard layouts | | Empty State | `empty-state.md` | No content states | | Metrics Card | `metrics-card.md` | KPI displays | | Resource List | `resource-list.md` | Filterable lists | | Setup Guide | `setup-guide.md` | Onboarding flows | ## Best Practices 1. **Follow Templates** - Use established templates for common pages 2. **Consistent Layout** - Maintain consistent structure across pages 3. **Progressive Disclosure** - Show advanced options only when needed 4. **Clear Hierarchy** - Use sections to organize content logically 5. **Actionable CTAs** - Make primary actions obvious 6. **Empty States** - Always provide guidance when no data exists 7. **Loading States** - Show skeletons during data fetch 8. **Error Handling** - Display clear, actionable error messages 9. **Mobile Responsive** - All patterns work on mobile devices 10. **Accessibility** - Ensure keyboard navigation and screen readers work --- **Remember**: Using established patterns improves UX consistency and reduces development time.