Skip to content

Instantly share code, notes, and snippets.

@bfollington
Last active December 10, 2025 04:54
Show Gist options
  • Select an option

  • Save bfollington/009b385967afb703de6501f5d85b5d04 to your computer and use it in GitHub Desktop.

Select an option

Save bfollington/009b385967afb703de6501f5d85b5d04 to your computer and use it in GitHub Desktop.
pattern-index.md
# Common Patterns
Prefix the URLs with
`https://raw.githubusercontent.com/commontoolsinc/labs/refs/heads/main/packages/patterns/`
## `counter.tsx`
A simple counter demo.
### Input Schema
```ts
interface CounterInput {
value: number;
}
```
### Result Schema
```ts
interface CounterOutput {
value?: number;
increment: Stream<void>;
decrement: Stream<void>;
}
```
## `todo-list.tsx`
A todo list with AI suggestions.
### Input Schema
```ts
interface Input {
items: Cell<TodoItem[]>;
}
```
### Result Schema
```ts
interface TodoItem {
title: string;
done: Default<boolean, false>;
}
interface Output {
items: Cell<TodoItem[]>;
}
```
## `note.tsx`
A note demo.
### Input Schema
```ts
type NoteInput = {
/** The title of the note */
title: string;
/** The content of the note */
content: string;
};
```
### Result Schema
```ts
type NoteOutput = {
/** The content of the note */
content: string;
grep: Stream<{ query: string }>;
translate: Stream<{ language: string }>;
editContent: Stream<{ detail: { value: string } }>;
};
```
## `favorites-manager.tsx`
A manager for viewing and removing favorited cells.
### Input Schema
```ts
type Input = Record<string, never>;
```
### Result Schema
```ts
type Favorite = { cell: Cell<{ [NAME]?: string }>; tag: string };
type Output = {
[NAME]: string;
[UI]: JSX.Element;
};
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment