# A kit's own part instead of another's — replaces and ui-kit-replaces-this-part

> A kit declares in its package.osy which parts of other kits (or which platform atoms) it offers its own for. In an app that uses the kit, osy lint's ui-kit-replaces-this-part (SHOULD) reports each page that draws a replaced part and names the kit's part to draw instead. Turn it off for one page with [SuppressWarning] on the component, or for the whole app on its app { } manifest.

<!-- id: ui-kit-replacements · area: ui · stability: stable · html: https://osysharp.com/reference/ui/kit-replacements/ -->

## Summary        {#summary}
A kit knows when it has a better part than the one a page reaches for — the Osyrin look has its own dropdown, drawn as
its boards draw it, where the browser's `<select>` looks different in every browser. The kit says so once, in its
`package.osy`, and every app that uses it hears it from `osy lint` on the page that drew the other part.

```osy syntax
replaces "Select" {
  use "LookSelect";
  why "the browser's own select cannot be drawn as the boards' §22 dropdown";
}
```

## Signature      {#signature}

```text
replaces "<Part>" { use "<KitPart>"; [unless "<argument>";] [why "<reason>";] }
```

- **`<Part>`** — the replaced part's bare name: a platform atom (`Select`) or another kit's component (`SelectField`).
- **`use`** (required) — the kit's own component to draw instead. One the kit does not declare is a compile error in the
  kit (`PACKAGE_REPLACES_UNKNOWN_PART`).
- **`unless`** — an argument whose presence makes the call a face the kit does not replace.
- **`why`** — the reason the finding gives.

## Description    {#description}

### What the app hears   {#finding}
`ui-kit-replaces-this-part` is a **SHOULD** finding on each call of a replaced part in one of the app's own components:

```console
SHOULD  ui-kit-replaces-this-part  ShopPage (Select → LookSelect)
  'ShopPage' draws `Select`, and Osysharp.Look, which this app uses, offers `LookSelect` for it instead. The browser's own
  select cannot be drawn as the boards' §22 dropdown.
  → draw `LookSelect` here (`osy kit LookSelect` for its signature).
```

### When is it silent?   {#silent}
- The app does not use a kit that declares the replacement.
- The call carries the entry's `unless` argument (`SelectField(…, detail: …)` draws its own list).
- The app declares its own component of the replaced name — that is not the part the kit means.
- The call is inside a kit's code. The rule judges the app's own pages.

### Turning it off   {#off}
For one page, say why on the component: `[SuppressWarning("ui-kit-replaces-this-part")]`. For the whole app, put it on
the `app { }` manifest. The kit an app uses is an app-wide choice, so this rule also accepts the manifest form, which
covers every page:

```osy syntax
[SuppressWarning("ui-kit-replaces-this-part")]
app Shop { use Osysharp.Look@0; }
```

### What Osysharp.Look replaces   {#look}
| Replaced | Use | Unless |
|---|---|---|
| `Select` (the browser's select) | `LookSelect` | — |
| `SelectField` | `LookSelect` (over an enum `LookEnumSelect`, over rows `LookRefPicker`) | `detail` |

A page that draws the look's own dropdown instead of `Select` gets no finding:

```osy title="the page draws LookSelect, so the rule is silent" test app=ui-kit-replacements
using Osysharp.Look;

[Route("/shop")]
[AllowAnonymous]
component ShopPage() {
  string size = "M";

  render {
    LookSelect("Size", size, ["S", "M", "L"]);
  }
}
```

## See also       {#see-also}
- [package.osy](https://osysharp.com/reference/project/package/) — `package.osy`, where a kit writes `replaces`
- [A picker over every row — the SearchPicker](https://osysharp.com/reference/ui/search-pickers/) — a picker over rows the database answers
- [[SuppressWarning]](https://osysharp.com/reference/diagnostics/suppress-warning/) — accepting one finding about one declaration
