flowglad-pricing-ui
A utility for building pricing interfaces, handling plan states, and formatting currency with Flowglad.
Install
mkdir -p .claude/skills/flowglad-pricing-ui && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3795" && unzip -o skill.zip -d .claude/skills/flowglad-pricing-ui && rm skill.zipInstalls to .claude/skills/flowglad-pricing-ui
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Build pricing pages, pricing cards, and plan displays with Flowglad. Use this skill when creating pricing tables, displaying subscription options, or building plan comparison interfaces.Key capabilities
- →Render pricing cards with billing interval toggle logic
- →Manage loading states for pricing model data fetching
- →Format raw currency values from integer cents
- →Highlight active user subscription plans via comparison logic
- →Filter pricing options based on selected billing cycles
How it works
It utilizes helper functions to transform pricing data models into stateful UI components that react to user interval selections.
Inputs & outputs
When to use flowglad-pricing-ui
- →Create pricing tables for SaaS products
- →Implement billing cycle interval toggles
- →Display subscription plan features
- →Build responsive pricing cards
About this skill
Flowglad Pricing UI
Abstract
Comprehensive guide for building pricing pages, pricing cards, and plan displays with Flowglad. Covers loading states, accessing pricing data through helper functions, formatting prices correctly, highlighting current subscriptions, implementing billing interval toggles, and responsive layout patterns.
Table of Contents
- Loading States — CRITICAL
- Accessing Pricing Data — HIGH
- Building Pricing Cards — MEDIUM
- Current Plan Highlighting — MEDIUM
- Billing Interval Toggle — MEDIUM
- Responsive Layout — LOW
1. Loading States
Impact: CRITICAL
The pricing model loads asynchronously. Rendering before data is available causes visual flicker, incorrect UI states, or hydration mismatches.
1.1 Wait for pricingModel Before Rendering
Impact: CRITICAL (prevents flash of incorrect content)
Always check that billing data has loaded before rendering pricing UI. The pricingModel is null or undefined until the billing data loads.
Incorrect: renders empty or broken UI while loading
function PricingPage() {
const billing = useBilling()
// BUG: pricingModel is undefined while loading!
// This renders empty pricing grid, then re-renders when data arrives
const products = billing.pricingModel?.products ?? []
return (
<div className="pricing-grid">
{products.map((product) => (
<PricingCard key={product.id} product={product} />
))}
</div>
)
}
Users see an empty pricing page that suddenly fills in, causing layout shift and poor UX.
Correct: show loading state until data is ready
function PricingPage() {
const billing = useBilling()
// Wait for billing to load
if (!billing.loaded) {
return <PricingPageSkeleton />
}
// Handle error state
if (billing.errors) {
return <div>Unable to load pricing. Please try again.</div>
}
// Now safe to access pricingModel
const products = billing.pricingModel?.products ?? []
return (
<div className="pricing-grid">
{products.map((product) => (
<PricingCard key={product.id} product={product} />
))}
</div>
)
}
Alternative: early return pattern
function PricingPage() {
const billing = useBilling()
if (!billing.loaded || billing.errors || !billing.pricingModel) {
return <PricingPageSkeleton />
}
// TypeScript now knows pricingModel is defined
const { products } = billing.pricingModel
return (
<div className="pricing-grid">
{products.map((product) => (
<PricingCard key={product.id} product={product} />
))}
</div>
)
}
1.2 Public Pricing Pages with usePricingModel
Impact: CRITICAL (enables unauthenticated pricing pages)
For public pricing pages that don't require authentication, use the usePricingModel() hook instead of useBilling(). This returns only the pricing data without requiring a logged-in user.
Incorrect: uses useBilling for public page
// Public pricing page - no user logged in
function PublicPricingPage() {
// BUG: useBilling requires authentication context
// Will fail or return empty data for unauthenticated users
const billing = useBilling()
if (!billing.loaded) return <div>Loading...</div>
return <PricingDisplay products={billing.pricingModel?.products} />
}
Correct: uses usePricingModel for public pages
import { usePricingModel } from '@flowglad/nextjs'
function PublicPricingPage() {
// Works without authentication
const pricingModel = usePricingModel()
// Returns null while loading
if (!pricingModel) {
return <PricingPageSkeleton />
}
return (
<div className="pricing-grid">
{pricingModel.products.map((product) => {
const defaultPrice = product.defaultPrice ?? product.prices?.[0]
return (
<article key={product.slug}>
<h3>{product.name}</h3>
<p>{product.description}</p>
{defaultPrice && (
<p>
${(defaultPrice.unitPrice / 100).toFixed(2)}
{defaultPrice.intervalUnit && `/${defaultPrice.intervalUnit}`}
</p>
)}
</article>
)
})}
</div>
)
}
When to use each hook:
useBilling()- Authenticated pages where you need subscription status, checkout, or user-specific datausePricingModel()- Public pricing pages, marketing sites, or anywhere you just need to display plans
2. Accessing Pricing Data
Impact: HIGH
Flowglad provides helper functions to access products and prices by slug. Using these helpers is more reliable than manual array lookups.
2.1 Use getProduct and getPrice Helpers
Impact: HIGH (prevents runtime errors, cleaner code)
The billing object provides getProduct() and getPrice() helper functions that look up items by slug. Use these instead of manually searching arrays.
Incorrect: manual array lookup
function UpgradeButton({ targetPriceSlug }: { targetPriceSlug: string }) {
const billing = useBilling()
if (!billing.loaded) return null
// Fragile: searches across all products, easy to get wrong
const targetPrice = billing.pricingModel?.products
.flatMap((p) => p.prices)
.find((price) => price.slug === targetPriceSlug)
if (!targetPrice) return null
return <button>Upgrade to {targetPrice.name}</button>
}
Correct: use getPrice helper
function UpgradeButton({ targetPriceSlug }: { targetPriceSlug: string }) {
const billing = useBilling()
if (!billing.loaded) return null
// Clean: helper does the lookup efficiently
const targetPrice = billing.getPrice(targetPriceSlug)
if (!targetPrice) return null
return <button>Upgrade to {targetPrice.name}</button>
}
Same pattern for products:
function ProductFeatures({ productSlug }: { productSlug: string }) {
const billing = useBilling()
if (!billing.loaded) return null
// Use getProduct helper
const product = billing.getProduct(productSlug)
if (!product) return null
return (
<ul>
{product.features.map((feature) => (
<li key={feature.id}>{feature.name}</li>
))}
</ul>
)
}
2.2 Filter Products for Display
Impact: HIGH (shows only relevant products)
Not all products should appear on pricing pages. Filter out default/free products and products without active prices.
Incorrect: displays all products including internal ones
function PricingGrid() {
const billing = useBilling()
if (!billing.loaded || !billing.pricingModel) return null
// BUG: Shows ALL products, including free tier and inactive products
return (
<div>
{billing.pricingModel.products.map((product) => (
<PricingCard key={product.id} product={product} />
))}
</div>
)
}
Correct: filter to displayable products
function PricingGrid() {
const billing = useBilling()
if (!billing.loaded || !billing.pricingModel) return null
// Filter products for display
const displayProducts = billing.pricingModel.products.filter((product) => {
// Skip default/free tier products
if (product.default === true) return false
// Only show products with active subscription prices
const hasActivePrice = product.prices.some(
(price) => price.type === 'subscription' && price.active === true
)
return hasActivePrice
})
return (
<div>
{displayProducts.map((product) => (
<PricingCard key={product.id} product={product} />
))}
</div>
)
}
Transform to UI-friendly format:
interface PricingPlan {
name: string
description?: string
displayPrice: string
slug: string
features: string[]
unitPrice: number
}
function transformProductsToPricingPlans(
pricingModel: PricingModel | null | undefined
): PricingPlan[] {
if (!pricingModel?.products) return []
return pricingModel.products
.filter((product) => {
if (product.default === true) return false
return product.prices.some(
(p) => p.type === 'subscription' && p.active === true
)
})
.map((product) => {
const price = product.prices.find(
(p) => p.type === 'subscription' && p.active === true
)
if (!price?.slug) return null
return {
name: product.name,
description: product.description,
displayPrice: `$${(price.unitPrice / 100).toFixed(2)}`,
slug: price.slug,
features: product.features.map((f) => f.name).filter(Boolean),
unitPrice: price.unitPrice,
}
---
*Content truncated.*
When not to use it
- →Building static, non-SaaS billing pages
- →Backend logic for subscription processing
Prerequisites
Limitations
- →Requires data provided in the specific Flowglad model structure
- →Strict dependency on React-based component architecture
- →UI patterns are opinionated toward the Flowglad standard
How it compares
It provides pre-built logic for common billing patterns like monthly/annual toggles, preventing the need to write custom state management for price calculation.
Compared to similar skills
flowglad-pricing-ui side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| flowglad-pricing-ui (this skill) | 1 | 5mo | No flags | Beginner |
| ai-model-web | 1 | 2mo | Review | Intermediate |
| podcast-generation | 1 | 3mo | Review | Advanced |
| convex-realtime | 1 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by flowglad
View all by flowglad →You might also like
ai-model-web
TencentCloudBase
Use this skill when developing browser/Web applications (React/Vue/Angular, static websites, SPAs) that need AI capabilities. Features text generation (generateText) and streaming (streamText) via @cloudbase/js-sdk. Built-in models include Hunyuan (hunyuan-2.0-instruct-20251111 recommended) and DeepSeek (deepseek-v3.2 recommended). NOT for Node.js backend (use ai-model-nodejs), WeChat Mini Program (use ai-model-wechat), or image generation (Node SDK only).
podcast-generation
microsoft
Generate AI-powered podcast-style audio narratives using Azure OpenAI's GPT Realtime Mini model via WebSocket. Use when building text-to-speech features, audio narrative generation, podcast creation from content, or integrating with Azure OpenAI Realtime API for real audio output. Covers full-stack implementation from React frontend to Python FastAPI backend with WebSocket streaming.
convex-realtime
waynesutton
Patterns for building reactive apps including subscription management, optimistic updates, cache behavior, and paginated queries with cursor-based loading
wagmi-development
wevm
Creates Wagmi features across all layers - core actions, query options, framework bindings. Use when adding new actions, hooks, or working across packages/core, packages/react, packages/vue.
query-layer
EpicenterHQ
Query layer patterns for consuming services with TanStack Query, error transformation, and runtime dependency injection. Use when implementing queries/mutations, transforming service errors for UI, or adding reactive data management.
rdc-setup
reactive
Install and set up @data-client/react or @data-client/vue in a project. Detects project type (NextJS, Expo, React Native, Vue, plain React) and protocol (REST, GraphQL, custom), then hands off to protocol-specific setup skills.