{
  "id": "@typed/ui/Collection#ref",
  "canonicalId": "@typed/ui/Collection#ref",
  "symbol": {
    "id": "@typed/ui/Collection#ref",
    "packageName": "@typed/ui",
    "moduleName": "Collection",
    "exportName": "ref",
    "kind": "function",
    "signatures": [
      "export declare function ref<Value, Element extends object, E, R>(collection: RefSubject.RefSubject<State<Value, Element>, E, R>, item: Omit<Item<Value, Element>, \"element\">): (element: Element) => Effect.Effect<void, E, R | Scope.Scope>;"
    ],
    "summary": "Registers a mounted element and removes it automatically with the Scope in which the returned\nEffect is run.",
    "sections": {
      "Why": "The operation exposes Collection's transition directly so callers can compose it in Effect\nprograms and native event handlers.",
      "Ownership and lifetime": "Registration is owned by the Scope in which the registration Effect runs. Closing that Scope\nremoves the exact registered item; creating the collection or state does not own this cleanup.",
      "Example": "Import with `import { ref } from \"@typed/ui/Collection\";` Extend the [Collection.makeState\nrunnable setup](/reference/%40typed%2Fui%2FCollection%23makeState). Inside the linked Effect\nprogram create `const attach = ref(collection, { id: \"save\", value: \"save\" })`, then run `yield*\nattach(document.createElement(\"button\"))` and read the collection before Scope close."
    },
    "examples": [],
    "relations": [],
    "source": {
      "file": "packages/ui/src/Collection.ts",
      "line": 213
    },
    "since": "1.0.0",
    "category": "Item registration"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/ui/Collection#ref",
    "packageName": "@typed/ui",
    "packageVersion": "1.0.0-beta.13",
    "moduleName": "Collection",
    "consumerSpecifier": "@typed/ui/Collection",
    "exportName": "ref",
    "qualifiedName": "ref",
    "declarationKey": "declaration:0c961c51bd8f6251f4accb14",
    "family": "function",
    "signatures": [
      "export declare function ref<Value, Element extends object, E, R>(collection: RefSubject.RefSubject<State<Value, Element>, E, R>, item: Omit<Item<Value, Element>, \"element\">): (element: Element) => Effect.Effect<void, E, R | Scope.Scope>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/ui/src/Collection.ts",
        "start": {
          "line": 213,
          "column": 1
        },
        "end": {
          "line": 218,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/ui#Collection.ref",
      "@typed/ui/index#Collection.ref"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:0c961c51bd8f6251f4accb14",
    "name": "ref",
    "family": "function",
    "facets": [
      {
        "family": "function",
        "syntaxKind": "FunctionDeclaration",
        "signatures": [
          "export declare function ref<Value, Element extends object, E, R>(collection: RefSubject.RefSubject<State<Value, Element>, E, R>, item: Omit<Item<Value, Element>, \"element\">): (element: Element) => Effect.Effect<void, E, R | Scope.Scope>;"
        ],
        "typeParameters": [
          "Value",
          "Element extends object",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/ui/src/Collection.ts",
            "start": {
              "line": 213,
              "column": 1
            },
            "end": {
              "line": 218,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare function ref<Value, Element extends object, E, R>(collection: RefSubject.RefSubject<State<Value, Element>, E, R>, item: Omit<Item<Value, Element>, \"element\">): (element: Element) => Effect.Effect<void, E, R | Scope.Scope>;"
    ],
    "typeParameters": [
      "Value",
      "Element extends object",
      "E",
      "R"
    ],
    "summary": "Registers a mounted element and removes it automatically with the Scope in which the returned\nEffect is run.",
    "sections": {
      "Why": "The operation exposes Collection's transition directly so callers can compose it in Effect\nprograms and native event handlers.",
      "Ownership and lifetime": "Registration is owned by the Scope in which the registration Effect runs. Closing that Scope\nremoves the exact registered item; creating the collection or state does not own this cleanup.",
      "Example": "Import with `import { ref } from \"@typed/ui/Collection\";` Extend the [Collection.makeState\nrunnable setup](/reference/%40typed%2Fui%2FCollection%23makeState). Inside the linked Effect\nprogram create `const attach = ref(collection, { id: \"save\", value: \"save\" })`, then run `yield*\nattach(document.createElement(\"button\"))` and read the collection before Scope close."
    },
    "examples": [],
    "sourceSpans": [
      {
        "file": "packages/ui/src/Collection.ts",
        "start": {
          "line": 213,
          "column": 1
        },
        "end": {
          "line": 218,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Item registration"
  }
}
