frontend-component

A set of Vue component rules covering file structure, naming, styling, icons, derived state, and browser tests.

In plain words
What is it for?
Use it when creating or editing Vue components and their tests, especially when choosing Tailwind or DaisyUI classes, Lucide icons, and reactive state patterns.
Why use it?
It prevents different components from using conflicting patterns or libraries in the same frontend.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nerds-odd-e/doughnut/frontend-component
Clone the repo
git clone --depth 1 https://github.com/nerds-odd-e/doughnut

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 919 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00919
Opus 5 $0.00000 $0.00460
Sonnet 5 $0.00000 $0.00184
Haiku 4.5 $0.00000 $0.00092

Measured 2d ago against content hash 544e7330432b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

frontend-component scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/frontend-component.mdc · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Frontend Component Rules

File Organization

  • Frontend code lives in frontend/src/.
  • Test code lives in frontend/tests/.
  • Generated backend API code is in frontend/src/generated/backend.

Core Technologies

  • Vue 3 with TypeScript.
  • DaisyUI + Tailwind for styling: unprefixed Tailwind utilities (flex, text-primary, …) and daisy--prefixed DaisyUI component classes (daisy-btn, daisy-card, …).
  • Vitest for testing with Playwright browser mode.
  • Biome for linting and formatting.

Icons

  • Prefer Lucide for normal UI icons via @lucide/vue (import { IconName } from "@lucide/vue"). Import only the icons each file needs; rely on currentColor so icons follow text/theme color.
  • @lucide/vue defaults to 24x24 via the size prop. Use :size="..." and/or Tailwind w-*, h-*, or size-* on icons.

Naming Conventions

  • Component files should use PascalCase, for example NoteShow.vue or GlobalBar.vue.
  • Test files should match component names with a .spec.ts suffix.
  • Use .vue for components and .ts for TypeScript files.

Component Structure

<script setup lang="ts">
import { computed, onMounted, ref } from "vue"

const props = defineProps<{
  value: string
}>()
const emit = defineEmits<{
  (e: "update:value", value: string): void
}>()

const loading = ref(false)
const displayValue = computed(() => props.value.toUpperCase())

const handleClick = () => {
  emit("update:value", "new value")
}

onMounted(() => {
  // ...
})
</script>

<template>
  <div class="daisy-component">
    <!-- template content -->
  </div>
</template>

<style scoped lang="scss">
// scoped styles
</style>

Modals And Dialogs

  • Use Modal from @/components/commons/Modal.vue for modal overlays. It wraps a native <dialog> teleported to body and centralizes stacking, ESC, backdrop click, and route-change close. The dim background is the native ::backdrop pseudo-element.
  • Put panel content in #body, optionally #header. Listen for @close_request to hide the modal, such as parent v-if or clearing model state. The overlay X is optional via showCloseButton on Modal.
  • Use v-if on Modal when the dialog opens, or keep Modal mounted and drive visibility from props; wire close_request and cancel buttons to the same close handler.
  • Layout variants: alignTop pins the panel to the top of the viewport, sidebar="left" | "right" renders a full-height side panel. Use isPopup for nested popups via usePopups so they do not participate in the ESC modal stack.
  • In tests, the dialog renders inside document.body. Query the DOM via document.querySelector("dialog"), .close-button, .modal-container, .modal-sidebar, or .modal-mask, not the dialog's internal layout wrapper.

Read the full file on GitHub · 89 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 89 lines · 0 tokens per session scan A 544e7330432b

Subscribe to this mod's changes

frontend-component is a cursor rule published in the GitHub repository nerds-odd-e/doughnut (49 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 919 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.