feat: Complete fleet — 94 skills across 10+ domains
Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
56
skills/vueuse-functions/references/useToggle.md
Normal file
56
skills/vueuse-functions/references/useToggle.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
category: Utilities
|
||||
---
|
||||
|
||||
# useToggle
|
||||
|
||||
A boolean switcher with utility functions.
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { useToggle } from '@vueuse/core'
|
||||
|
||||
const [value, toggle] = useToggle()
|
||||
```
|
||||
|
||||
When you pass a ref, `useToggle` will return a simple toggle function instead:
|
||||
|
||||
```ts
|
||||
import { useDark, useToggle } from '@vueuse/core'
|
||||
|
||||
const isDark = useDark()
|
||||
const toggleDark = useToggle(isDark)
|
||||
```
|
||||
|
||||
Note: be aware that the toggle function accepts the first argument as the override value. You might want to avoid directly passing the function to events in the template, as the event object will pass in.
|
||||
|
||||
```html
|
||||
<!-- caution: $event will be pass in -->
|
||||
<button @click="toggleDark" />
|
||||
<!-- recommended to do this -->
|
||||
<button @click="toggleDark()" />
|
||||
```
|
||||
|
||||
## Type Declarations
|
||||
|
||||
```ts
|
||||
export type ToggleFn = (value?: boolean) => void
|
||||
export type UseToggleReturn = [ShallowRef<boolean>, ToggleFn] | ToggleFn
|
||||
export interface UseToggleOptions<Truthy, Falsy> {
|
||||
truthyValue?: MaybeRefOrGetter<Truthy>
|
||||
falsyValue?: MaybeRefOrGetter<Falsy>
|
||||
}
|
||||
export declare function useToggle<Truthy, Falsy, T = Truthy | Falsy>(
|
||||
initialValue: Ref<T>,
|
||||
options?: UseToggleOptions<Truthy, Falsy>,
|
||||
): (value?: T) => T
|
||||
export declare function useToggle<
|
||||
Truthy = true,
|
||||
Falsy = false,
|
||||
T = Truthy | Falsy,
|
||||
>(
|
||||
initialValue?: T,
|
||||
options?: UseToggleOptions<Truthy, Falsy>,
|
||||
): [ShallowRef<T>, (value?: T) => T]
|
||||
```
|
||||
Reference in New Issue
Block a user