# Migrate a screen to Focus UI

Replace one complete workflow at a time. A client/project tracker makes a useful first slice: show active projects, filter by name or status, create and edit a record, confirm archiving, and report save success or failure. Keep the current app's data model and authorization rules.

## Map what the screen does

Use these as starting points for matching intent. They are selected examples, not a complete conversion table; verify the markup and available classes in [STYLING.md](https://focus-ui.de/ai/STYLING.md) and [COMPONENTS.md](https://focus-ui.de/ai/COMPONENTS.md).

| Existing pattern | Focus UI starting point |
| --- | --- |
| Bootstrap `.container`, `.row`, `.col-md-6` | `focus-container`, `focus-row`, `focus-col-md-6` |
| Bootstrap `.btn.btn-primary` | `focus-btn focus-btn-primary` |
| Bootstrap `.card` and card sections | `focus-card` with `focus-card-header`, `focus-card-body`, optional `focus-card-footer` |
| Bootstrap `.form-control` | Native input with `focus-input`; pair it with a visible label |
| Bootstrap `.table` | `focus-table`; add `Tables.init()` only for supported sorting |
| Tailwind `flex`, `gap-4`, `p-4` | `focus-d-flex`, `focus-gap-4`, `focus-p-4` |
| Tailwind button styling | `focus-btn` plus a semantic variant such as `focus-btn-primary` or `focus-btn-secondary` |
| Tailwind card surface | `focus-card` and its documented sections |

Do not mechanically prefix class names or translate every utility. Focus UI has its own layout, spacing, component markup, and tokens; retain small application-specific CSS where there is no direct equivalent. Its reset and base rules affect global elements, so check the host page for conflicts when both libraries are loaded.

## What Focus UI doesn't cover

Focus UI supplies presentation and selected browser interactions, not application state, durable storage, authorization, server validation, or complete framework components. Keep state and requests in your application, use its authorized server API for shared data, and retain small application CSS or an existing component library where a pattern has no direct counterpart. Use native controls and application handlers for behavior the library does not provide.

## Move behavior with the markup

Start with a semantic table or list and native filter/form controls. Keep filtering and the project's create/edit state in your application. On save, disable the submit button while the request is pending, restore it in `finally`, and show feedback only after the result is known. `Toast.show({ type, message })` accepts one configuration object. Handle failed HTTP responses explicitly; `fetch()` does not reject for an HTTP error status.

Use `Modal.confirm()` before archiving and catch its rejection so cancellation leaves the record untouched. Confirmation is not authorization: validate and authorize the archive on the server. Keep keyboard operation native where possible: labelled inputs, buttons for actions, visible focus, and a logical heading order. Test the actual screen at narrow widths; a table may need a scroll wrapper or a different mobile presentation.

For a prototype, seed records in memory and say so in the UI. `localStorage` can preserve one browser's data, but it is not shared, access-controlled, or a replacement for a server. The library does not supply storage, routes, validation policy, or backend behavior.

## Check one slice before expanding

Verify empty and filtered results, invalid input, pending/success/error states, archive cancel/confirm, keyboard use, narrow screens, and light/dark themes. Remove old handlers for migrated controls so one action has one owner. In a framework, let that framework own application state and initialize/destroy Focus UI behavior with the component lifecycle; see [FRAMEWORKS.md](https://focus-ui.de/ai/FRAMEWORKS.md). These lifecycle examples target v2.2.0; v2.0.0 does not contain all of those APIs. See [API.md](https://focus-ui.de/ai/API.md) for the version boundary.
