Token导航 LogoToken导航

Agent Skill · 研究检索

jem-ui-recipes(jem ui 食谱)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

jem-ui-recipes 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 65,208。

总安装 285周安装 12GitHub Stars 3下载 1核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:jem-ui-recipes(jem ui 食谱)
来源仓库:https://github.com/jem-open/jem-agent-skills
仓库路径:skills/jem-ui-recipes
安装命令:
npx skills add https://github.com/jem-open/jem-agent-skills --skill jem-ui-recipes
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jem-open/jem-agent-skills --skill jem-ui-recipes

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务;涉及真实页面改动时,应通过截图或浏览器预览检查表现。

通过 npx skills add 命令从指定 GitHub 仓库安装并使用。jem-ui-recipes 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/jem-ui-recipes

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/jem-open/jem-agent-skills --skill jem-ui-recip…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

jem-ui-recipes 怎么安装?

在终端执行 npx skills add https://github.com/jem-open/jem-agent-skills --skill jem-ui-recipes。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

jem-ui-recipes 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

jem-ui-recipes 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

jem-ui-recipes 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

jem-ui-recipes 用的人多吗?

公开数据是累计安装 285 次,近一周安装 12 次,下载 1 次,GitHub 3 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

jem-ui-recipes 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
jem-ui-recipes

jem ui 食谱 · 本页

2853需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

jem-ui-recipes

Copy-paste-ready code blocks for common pages and features built with @jem-open/jem-ui. Each recipe is a complete, working component with TypeScript types, realistic placeholder data, and inline comments marking customization points.


Step 1 — Check prerequisites

Before using any recipe, verify the project is set up for @jem-open/jem-ui.

Check 1: Package installed

Look for @jem-open/jem-ui in package.json dependencies. If missing, install it with peer dependencies:

npm install @jem-open/jem-ui

Check 2: Styles imported

Confirm the global entry point (e.g. app/layout.tsx, src/main.tsx) contains:

import "@jem-open/jem-ui/styles.css"

If missing, add it near the top of the file alongside other CSS imports.

Check 3: Tailwind preset configured

Confirm tailwind.config.ts (or .js) includes the jem-ui preset and content path:

import { jemUIPreset } from "@jem-open/jem-ui/tailwind"

export default {
  presets: [jemUIPreset],
  content: [
    "./node_modules/@jem-open/jem-ui/dist/**/*.{js,mjs}",
    // ...your app paths
  ],
}

Halt if any check fails — recipes will not render correctly without all three in place.


Step 2 — Select a recipe

Choose the recipe that best matches your use case:

RecipeDescriptionKey components
Search + filter + data tableSearchable, filterable table with paginationDataTable, DataTableColumnHeader, SearchInput, Select, Tag, EmptyState
CRUD form in a dialogCreate/edit modal with validationDialog, InputField, Select, Checkbox, Button
Settings page with sectionsTabbed settings with grouped form fieldsTabs, InputField, Switch, Select, Button, Divider
Detail drawerSide panel showing record detailsDrawer, Avatar, Tag, Button, Divider, Tooltip
Multi-step wizardStep-by-step flow with progressDialog, Progress, Button, form components
Empty state with CTAPlaceholder for empty pages/sectionsEmptyState, Button
Confirmation dialogDestructive action confirmationDialog, Button, Alert
File upload formUpload with progress and validationUpload, Button, Progress, Alert

Step 3 — Apply the recipe

Copy the recipe that matches your selection. Each recipe is a complete, working TypeScript/React component with all imports, types, state hooks, and // TODO: comments marking customization points.

Recipe 1: Search + filter + data table

"use client"

import { useState } from "react"
import {
  DataTable, DataTableColumnHeader, Tag, EmptyState
} from "@jem-open/jem-ui"
import { ColumnDef } from "@tanstack/react-table"

// TODO: Replace with your data type
type Employee = {
  id: string
  name: string
  email: string
  department: string
  status: "active" | "inactive" | "pending"
}

// TODO: Replace with your column definitions
const columns: ColumnDef<Employee>[] = [
  {
    accessorKey: "name",
    header: ({ column }) => <DataTableColumnHeader column={column} title="Name" />,
  },
  {
    accessorKey: "email",
    header: ({ column }) => <DataTableColumnHeader column={column} title="Email" />,
  },
  {
    accessorKey: "department",
    header: ({ column }) => <DataTableColumnHeader column={column} title="Department" />,
  },
  {
    accessorKey: "status",
    header: "Status",
    cell: ({ row }) => {
      const status = row.getValue("status") as string
      const variant = status === "active" ? "success" : status === "pending" ? "pending" : "failed"
      return <Tag variant={variant}>{status}</Tag>
    },
  },
]

// TODO: Replace with your data fetching
const sampleData: Employee[] = [
  { id: "1", name: "Alice Johnson", email: "alice@example.com", department: "Engineering", status: "active" },
  { id: "2", name: "Bob Smith", email: "bob@example.com", department: "Design", status: "active" },
  { id: "3", name: "Carol Williams", email: "carol@example.com", department: "Marketing", status: "pending" },
]

export function EmployeeTable() {
  // TODO: Replace with your data source
  const data = sampleData

  if (data.length === 0) {
    return (
      <EmptyState
        icon="users"
        title="No employees found"
        description="Add employees to see them listed here"
        primaryAction={{ label: "Add employee", onClick: () => {} }}
        variant="card"
      />
    )
  }

  return (
    <DataTable
      columns={columns}
      data={data}
      filterColumn="name"
      filterPlaceholder="Search by name..."
    />
  )
}

Recipe 2: CRUD form in a dialog

"use client"

import { useState } from "react"
import {
  Dialog, DialogTrigger, DialogContent, DialogHeader,
  DialogTitle, DialogDescription, DialogFooter, DialogClose
} from "@jem-open/jem-ui"
import {
  Button, InputField, Select, SelectTrigger, SelectContent,
  SelectItem, SelectValue, SelectField, CheckboxWithLabel
} from "@jem-open/jem-ui"

// TODO: Replace with your form data type
type UserFormData = {
  name: string
  email: string
  role: string
  sendInvite: boolean
}

export function CreateUserDialog() {
  const [open, setOpen] = useState(false)
  const [loading, setLoading] = useState(false)
  const [errors, setErrors] = useState<Record<string, string>>({})
  const [form, setForm] = useState<UserFormData>({
    name: "",
    email: "",
    role: "",
    sendInvite: true,
  })

  function validate(): boolean {
    const newErrors: Record<string, string> = {}
    if (!form.name) newErrors.name = "Name is required"
    if (!form.email) newErrors.email = "Email is required"
    if (!form.role) newErrors.role = "Role is required"
    setErrors(newErrors)
    return Object.keys(newErrors).length === 0
  }

  async function handleSubmit() {
    if (!validate()) return
    setLoading(true)
    try {
      // TODO: Replace with your API call
      await new Promise((resolve) => setTimeout(resolve, 1000))
      setOpen(false)
      setForm({ name: "", email: "", role: "", sendInvite: true })
      setErrors({})
    } finally {
      setLoading(false)
    }
  }

  return (
    <Dialog open={open} onOpenChange={setOpen}>
      <DialogTrigger asChild>
        <Button variant="primary">Add user</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Create new user</DialogTitle>
          <DialogDescription>Add a new user to your organization.</DialogDescription>
        </DialogHeader>
        <div className="flex flex-col gap-md py-md">
          <InputField
            label="Full name"
            value={form.name}
            onChange={(e) => setForm({ ...form, name: e.target.value })}
            error={!!errors.name}
            helperText={errors.name}
          />
          <InputField
            label="Email"
            type="email"
            value={form.email}
            onChange={(e) => setForm({ ...form, email: e.target.value })}
            error={!!errors.email}
            helperText={errors.email}
          />
          <SelectField label="Role">
            <Select value={form.role} onValueChange={(value) => setForm({ ...form, role: value })}>
              <SelectTrigger>
                <SelectValue placeholder="Select a role" />
              </SelectTrigger>
              <SelectContent>
                <SelectItem value="admin">Admin</SelectItem>
                <SelectItem value="editor">Editor</SelectItem>
                <SelectItem value="viewer">Viewer</SelectItem>
              </SelectContent>
            </Select>
          </SelectField>
          <CheckboxWithLabel
            label="Send invite email"
            description="User will receive an email to set up their account"
            checked={form.sendInvite}
            onCheckedChange={(checked) => setForm({ ...form, sendInvite: checked as boolean })}
          />
        </div>
        <DialogFooter>
          <DialogClose asChild>
            <Button variant="outline">Cancel</Button>
          </DialogClose>
          <Button variant="primary" loading={loading} onClick={handleSubmit}>
            Create user
          </Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}

Recipe 3: Settings page with sections

"use client"

import { useState } from "react"
import {
  Tabs, TabsList, TabsTrigger, TabsContent
} from "@jem-open/jem-ui"
import {
  Button, InputField, SwitchWithLabel, Select, SelectTrigger,
  SelectContent, SelectItem, SelectValue, SelectField, Divider
} from "@jem-open/jem-ui"
import { toast } from "sonner"

export function SettingsPage() {
  // TODO: Replace with your settings state
  const [name, setName] = useState("Jane Doe")
  const [email, setEmail] = useState("jane@example.com")
  const [emailNotifs, setEmailNotifs] = useState(true)
  const [pushNotifs, setPushNotifs] = useState(false)
  const [language, setLanguage] = useState("en")

  function handleSave() {
    // TODO: Replace with your save logic
    toast.success("Settings saved")
  }

  return (
    <div className="flex flex-col gap-md max-w-2xl">
      <h1 className="text-2xl font-semibold text-greyscale-text-title">Settings</h1>

      <Tabs defaultValue="profile">
        <TabsList variant="line">
          <TabsTrigger variant="line" value="profile">Profile</TabsTrigger>
          <TabsTrigger variant="line" value="notifications">Notifications</TabsTrigger>
          <TabsTrigger variant="line" value="preferences">Preferences</TabsTrigger>
        </TabsList>

        <TabsContent value="profile">
          <div className="flex flex-col gap-md py-md">
            <InputField label="Display name" value={name} onChange={(e) => setName(e.target.value)} />
            <InputField label="Email" type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
            <Divider spacing="md" />
            <div className="flex justify-end">
              <Button variant="primary" onClick={handleSave}>Save profile</Button>
            </div>
          </div>
        </TabsContent>

        <TabsContent value="notifications">
          <div className="flex flex-col gap-md py-md">
            <SwitchWithLabel
              label="Email notifications"
              description="Receive updates about your account via email"
              checked={emailNotifs}
              onCheckedChange={setEmailNotifs}
            />
            <SwitchWithLabel
              label="Push notifications"
              description="Receive push notifications in your browser"
              checked={pushNotifs}
              onCheckedChange={setPushNotifs}
            />
            <Divider spacing="md" />
            <div className="flex justify-end">
              <Button variant="primary" onClick={handleSave}>Save notifications</Button>
            </div>
          </div>
        </TabsContent>

        <TabsContent value="preferences">
          <div className="flex flex-col gap-md py-md">
            <SelectField label="Language">
              <Select value={language} onValueChange={setLanguage}>
                <SelectTrigger>
                  <SelectValue />
                </SelectTrigger>
                <SelectContent>
                  <SelectItem value="en">English</SelectItem>
                  <SelectItem value="es">Spanish</SelectItem>
                  <SelectItem value="fr">French</SelectItem>
                </SelectContent>
              </Select>
            </SelectField>
            <Divider spacing="md" />
            <div className="flex justify-end">
              <Button variant="primary" onClick={handleSave}>Save preferences</Button>
            </div>
          </div>
        </TabsContent>
      </Tabs>
    </div>
  )
}

Recipe 4: Detail drawer

"use client"

import {
  Drawer, DrawerTrigger, DrawerContent, DrawerHeader,
  DrawerBody, DrawerFooter, DrawerTitle, DrawerClose
} from "@jem-open/jem-ui"
import {
  Button, Avatar, AvatarImage, AvatarFallback, Tag, Divider,
  Tooltip, TooltipTrigger, TooltipContent
} from "@jem-open/jem-ui"
import { Mail, Phone } from "lucide-react"

// TODO: Replace with your data type
type Contact = {
  name: string
  initials: string
  email: string
  phone: string
  role: string
  status: "active" | "inactive"
  avatarUrl?: string
}

export function ContactDetailDrawer({ contact }: { contact: Contact }) {
  return (
    <Drawer direction="right">
      <DrawerTrigger asChild>
        <Button variant="ghost" size="sm">View</Button>
      </DrawerTrigger>
      <DrawerContent>
        <DrawerHeader>
          <DrawerTitle>Contact Details</DrawerTitle>
        </DrawerHeader>
        <DrawerBody>
          <div className="flex items-center gap-md mb-md">
            <Avatar size="lg">
              {contact.avatarUrl && <AvatarImage src={contact.avatarUrl} alt={contact.name} />}
              <AvatarFallback size="lg">{contact.initials}</AvatarFallback>
            </Avatar>
            <div>
              <p className="text-lg font-semibold text-greyscale-text-title">{contact.name}</p>
              <Tag variant={contact.status === "active" ? "success" : "failed"}>
                {contact.status}
              </Tag>
            </div>
          </div>

          <Divider spacing="md" />

          <div className="flex flex-col gap-sm">
            <div className="flex justify-between items-center">
              <span className="text-greyscale-text-subtitle">Role</span>
              <span className="text-greyscale-text-body">{contact.role}</span>
            </div>
            <div className="flex justify-between items-center">
              <span className="text-greyscale-text-subtitle">Email</span>
              <Tooltip>
                <TooltipTrigger asChild>
                  <a href={`mailto:${contact.email}`} className="text-secondary-text-label flex items-center gap-xxs">
                    <Mail className="size-4" /> {contact.email}
                  </a>
                </TooltipTrigger>
                <TooltipContent>Send email</TooltipContent>
              </Tooltip>
            </div>
            <div className="flex justify-between items-center">
              <span className="text-greyscale-text-subtitle">Phone</span>
              <span className="flex items-center gap-xxs text-greyscale-text-body">
                <Phone className="size-4" /> {contact.phone}
              </span>
            </div>
          </div>
        </DrawerBody>
        <DrawerFooter>
          <Button variant="primary">Edit contact</Button>
          <DrawerClose asChild>
            <Button variant="outline">Close</Button>
          </DrawerClose>
        </DrawerFooter>
      </DrawerContent>
    </Drawer>
  )
}

Recipe 5: Multi-step wizard

"use client"

import { useState } from "react"
import {
  Dialog, DialogTrigger, DialogContent, DialogHeader,
  DialogTitle, DialogDescription, DialogFooter, DialogClose
} from "@jem-open/jem-ui"
import { Button, InputField, Progress } from "@jem-open/jem-ui"
import {
  Select, SelectTrigger, SelectContent, SelectItem, SelectValue, SelectField,
  CheckboxWithLabel
} from "@jem-open/jem-ui"

const TOTAL_STEPS = 3

export function OnboardingWizard() {
  const [open, setOpen] = useState(false)
  const [step, setStep] = useState(1)
  const [loading, setLoading] = useState(false)

  // TODO: Replace with your form state
  const [form, setForm] = useState({
    companyName: "",
    industry: "",
    teamSize: "",
    inviteEmails: "",
    agreeToTerms: false,
  })

  function handleNext() {
    // TODO: Add step validation
    if (step < TOTAL_STEPS) setStep(step + 1)
  }

  function handleBack() {
    if (step > 1) setStep(step - 1)
  }

  async function handleSubmit() {
    setLoading(true)
    try {
      // TODO: Replace with your API call
      await new Promise((resolve) => setTimeout(resolve, 1000))
      setOpen(false)
      setStep(1)
    } finally {
      setLoading(false)
    }
  }

  return (
    <Dialog open={open} onOpenChange={(isOpen) => { setOpen(isOpen); if (!isOpen) setStep(1) }}>
      <DialogTrigger asChild>
        <Button variant="primary">Get started</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <div className="mb-sm">
            <Progress value={(step / TOTAL_STEPS) * 100} />
          </div>
          <DialogTitle>
            {step === 1 && "Company details"}
            {step === 2 && "Invite your team"}
            {step === 3 && "Review & confirm"}
          </DialogTitle>
          <DialogDescription>Step {step} of {TOTAL_STEPS}</DialogDescription>
        </DialogHeader>

        <div className="flex flex-col gap-md py-md">
          {step === 1 && (
            <>
              <InputField
                label="Company name"
                value={form.companyName}
                onChange={(e) => setForm({ ...form, companyName: e.target.value })}
              />
              <SelectField label="Industry">
                <Select value={form.industry} onValueChange={(v) => setForm({ ...form, industry: v })}>
                  <SelectTrigger><SelectValue placeholder="Select industry" /></SelectTrigger>
                  <SelectContent>
                    <SelectItem value="tech">Technology</SelectItem>
                    <SelectItem value="finance">Finance</SelectItem>
                    <SelectItem value="healthcare">Healthcare</SelectItem>
                    <SelectItem value="other">Other</SelectItem>
                  </SelectContent>
                </Select>
              </SelectField>
            </>
          )}

          {step === 2 && (
            <>
              <SelectField label="Team size">
                <Select value={form.teamSize} onValueChange={(v) => setForm({ ...form, teamSize: v })}>
                  <SelectTrigger><SelectValue placeholder="Select size" /></SelectTrigger>
                  <SelectContent>
                    <SelectItem value="1-10">1-10</SelectItem>
                    <SelectItem value="11-50">11-50</SelectItem>
                    <SelectItem value="51-200">51-200</SelectItem>
                    <SelectItem value="200+">200+</SelectItem>
                  </SelectContent>
                </Select>
              </SelectField>
              <InputField
                label="Invite by email"
                description="Comma-separated email addresses"
                value={form.inviteEmails}
                onChange={(e) => setForm({ ...form, inviteEmails: e.target.value })}
                placeholder="alice@co.com, bob@co.com"
              />
            </>
          )}

          {step === 3 && (
            <>
              <div className="flex flex-col gap-xs text-sm">
                <div className="flex justify-between">
                  <span className="text-greyscale-text-subtitle">Company</span>
                  <span className="text-greyscale-text-body">{form.companyName || "—"}</span>
                </div>
                <div className="flex justify-between">
                  <span className="text-greyscale-text-subtitle">Industry</span>
                  <span className="text-greyscale-text-body">{form.industry || "—"}</span>
                </div>
                <div className="flex justify-between">
                  <span className="text-greyscale-text-subtitle">Team size</span>
                  <span className="text-greyscale-text-body">{form.teamSize || "—"}</span>
                </div>
              </div>
              <CheckboxWithLabel
                label="I agree to the terms of service"
                checked={form.agreeToTerms}
                onCheckedChange={(checked) => setForm({ ...form, agreeToTerms: checked as boolean })}
              />
            </>
          )}
        </div>

        <DialogFooter>
          {step > 1 && (
            <Button variant="outline" onClick={handleBack}>Back</Button>
          )}
          {step < TOTAL_STEPS ? (
            <Button variant="primary" onClick={handleNext}>Next</Button>
          ) : (
            <Button variant="primary" loading={loading} onClick={handleSubmit}>
              Complete setup
            </Button>
          )}
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}

Recipe 6: Empty state with CTA

"use client"

import { EmptyState } from "@jem-open/jem-ui"

// TODO: Replace icon, title, description, and actions to match your empty state
// Default variant
export function NoProjectsState({ onCreate }: { onCreate: () => void }) {
  return (
    <EmptyState
      icon="folder"
      title="No projects yet"
      description="Create your first project to get started"
      primaryAction={{ label: "Create project", onClick: onCreate }}
      secondaryAction={{ label: "Learn more", href: "/docs" }}
    />
  )
}

// Card variant — use inside a section or panel
export function NoSearchResults({ onClearFilters }: { onClearFilters: () => void }) {
  return (
    <EmptyState
      icon="search"
      title="No results found"
      description="Try adjusting your search terms or filters"
      primaryAction={{ label: "Clear filters", onClick: onClearFilters }}
      variant="card"
      size="sm"
    />
  )
}

Recipe 7: Confirmation dialog

"use client"

import { useState } from "react"
import {
  Dialog, DialogTrigger, DialogContent, DialogHeader,
  DialogTitle, DialogDescription, DialogFooter, DialogClose
} from "@jem-open/jem-ui"
import { Button, Alert, AlertDescription } from "@jem-open/jem-ui"

export function DeleteConfirmDialog({ onDelete }: { onDelete: () => Promise<void> }) {
  const [open, setOpen] = useState(false)
  const [loading, setLoading] = useState(false)

  async function handleDelete() {
    setLoading(true)
    try {
      // TODO: Replace with your delete logic
      await onDelete()
      setOpen(false)
    } finally {
      setLoading(false)
    }
  }

  return (
    <Dialog open={open} onOpenChange={setOpen}>
      <DialogTrigger asChild>
        <Button variant="destructive">Delete</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle variant="error">Delete item</DialogTitle>
          <DialogDescription>This action cannot be undone.</DialogDescription>
        </DialogHeader>
        <Alert variant="destructive">
          <AlertDescription>
            All associated data will be permanently removed from your account.
          </AlertDescription>
        </Alert>
        <DialogFooter>
          <DialogClose asChild>
            <Button variant="outline">Cancel</Button>
          </DialogClose>
          <Button variant="destructive" loading={loading} onClick={handleDelete}>
            Delete permanently
          </Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}

Recipe 8: File upload form

"use client"

import { useState } from "react"
import { Upload, Button, Progress, Alert, AlertDescription } from "@jem-open/jem-ui"

type UploadState = "default" | "uploading" | "uploaded"

export function FileUploadForm() {
  const [state, setState] = useState<UploadState>("default")
  const [progress, setProgress] = useState(0)
  const [fileName, setFileName] = useState("")
  const [error, setError] = useState("")

  function handleSelectFile() {
    // TODO: Replace with your file selection logic
    const input = document.createElement("input")
    input.type = "file"
    input.accept = ".pdf,.doc,.docx"
    input.onchange = (e) => {
      const file = (e.target as HTMLInputElement).files?.[0]
      if (!file) return

      // TODO: Replace with your validation
      if (file.size > 10 * 1024 * 1024) {
        setError("File must be under 10MB")
        return
      }

      setError("")
      setFileName(file.name)
      simulateUpload()
    }
    input.click()
  }

  function simulateUpload() {
    setState("uploading")
    setProgress(0)
    // TODO: Replace with your actual upload logic
    const interval = setInterval(() => {
      setProgress((prev) => {
        if (prev >= 100) {
          clearInterval(interval)
          setState("uploaded")
          return 100
        }
        return prev + 10
      })
    }, 200)
  }

  function handleRemove() {
    setState("default")
    setProgress(0)
    setFileName("")
    setError("")
  }

  function handleSubmit() {
    // TODO: Replace with your submit logic
    console.log("Submitting file:", fileName)
  }

  return (
    <div className="flex flex-col gap-md max-w-md">
      {error && (
        <Alert variant="destructive">
          <AlertDescription>{error}</AlertDescription>
        </Alert>
      )}
      <Upload
        state={state}
        progress={progress}
        fileName={fileName}
        title="Upload document"
        description="PDF, DOC, or DOCX files"
        maxSize="10MB"
        onSelectFile={handleSelectFile}
        onRemoveFile={handleRemove}
        onSubmit={handleSubmit}
      />
    </div>
  )
}

Step 4 — Customize the recipe

After pasting a recipe, adapt it to your application:

Data & types:

  • Replace the // TODO: type definition with your actual data type
  • Replace sample data arrays with your data source (API calls, database queries, props)
  • Update ColumnDef definitions to match your data fields

Form fields:

  • Add or remove form fields to match your data model
  • Update validation logic in validate() functions
  • Wire onSubmit to your API endpoint

Layout:

  • Adjust max-w-* classes for your page width
  • Change spacing tokens (gap-md, py-md) if needed
  • Add Breadcrumb above the component for navigation context

State management:

  • Replace useState with your state management (React Hook Form, Zustand, etc.)
  • Connect controlled dialogs/drawers to your routing if needed
  • Replace toast.success() messages with your copy

Step 5 — Verify the result

Run through this checklist before considering the recipe complete:

  • Every interactive component has an accessible label (InputField label, Button text, IconButton aria-label)
  • Spacing between elements uses design tokens (gap-md, p-sm), not arbitrary values (gap-6, p-4)
  • Loading states are handled (Button loading prop during async operations)
  • Empty states are handled (EmptyState when no data, not a blank page)
  • Error states are handled (InputField error + helperText, Alert for form-level errors, toast.error for async failures)
  • Class composition uses cn() from @jem-open/jem-ui if custom classes were added
  • No unnecessary wrapper elements (use asChild on triggers instead)
  • TooltipProvider is present in the layout (if using Tooltip)
  • Toaster is added once in the root layout (if using toast)
  • All // TODO: comments have been addressed or intentionally left for future work

平台分布

Codex

36.82%
按下载量换算0

Claude

28.4%
按下载量换算0

Cursor

17.51%
按下载量换算0

Gemini CLI

9.72%
按下载量换算0

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills