[Components](https://oods-foundry.com/components) / core

# RoleAssignmentForm

Presents controls for assigning a role.

Generated from @oods/foundry 0.10.1

- Categories

  core

- Contexts

  form

- Readiness

  `proven-in-generated-apps`

## Playground

This component's contract doesn't list typed props, so the playground shows its documented example.

Documented example `role-assignment-form-roles` : mount, a Role select listing Owner and viewer with viewer selected and an Assignee input holding the address.

The render follows the page's theme switch: light, dark or high contrast. Both frameworks render the same example.

The real RoleAssignmentForm, live

React

Vue

## Code

The documented example. HTML is the markup the React component renders for it, which @oods/component-styles styles.

**React**

```
import { RoleAssignmentForm } from '@oods/components-react';
import '@oods/component-styles/css';

const availableRoles = [
  {
    "id": "owner",
    "label": "Owner"
  },
  "viewer"
];

export function Example() {
  return (
    <RoleAssignmentForm
      title="Assign role"
      availableRoles={availableRoles}
      role="viewer"
      assignee="ada@example.test"
    />
  );
}
```

## Props, slots and events

Contract version 1.1.0. Types are from the React declarations in @oods/components-react.

Props

| Prop | Type | Required | Documented example |
| - | - | - | - |
| `title` | `string \| undefined` | no | `Assign role` |
| `label` | `string \| undefined` | no | |
| `heading` | `string \| undefined` | no | |
| `name` | `string \| undefined` | no | |
| `description` | `string \| undefined` | no | |
| `subtitle` | `string \| undefined` | no | |
| `hint` | `string \| undefined` | no | |
| `roles` | `readonly unknown[] \| undefined` | no | |
| `availableRoles` | `readonly unknown[] \| undefined` | no | `[{"id":"owner","label":"Owner"},"viewer"]` |
| `role` | `string \| undefined` | no | `viewer` |
| `defaultRoleId` | `string \| undefined` | no | |
| `assignee` | `string \| undefined` | no | `ada@example.test` |
| `member` | `string \| undefined` | no | |

### Slots

default

### Events

none

## States

editing

## Accessibility

- Role

  `textbox`

- How it gets its name

  `label` on `input[name="assignee"]`

### Keyboard

Keyboard

| Key | What it does |
| - | - |
| `Tab` | Move focus to the named native control |
| `x` | Edit the named control |

### Obligations in the contract

- A real h3 heading names the form
- Role is a labelled select and Assignee a labelled text input

Mirrors renderRoleAssignmentForm over renderFormContainer with data-form-type=role-assignment: title aliases title/label/heading/name (default Role Assignment), subtitle aliases description/subtitle/hint, a Role select over roles, then availableRoles (record labels use label, then name; IDs remain values), selecting role, then defaultRoleId, and an Assignee input prefilled from assignee/member; authored children replace the generated body. availableRolesField lowers to availableRoles; membershipField is consumed unbound; defaultRoleParameter is consumed. The controls are unwired and submitting is a no-op.

## Tokens

The token roles this component reads.

- `form.background`
- `form.border`
- `form.text`
- `form.hint`

## Readiness

The evidence recorded for this component, with its label.

`proven-in-generated-apps`: catalog_list gives this label when generated React and Vue apps in the runtime sweep that ships with this version both use the component. That sweep was measured on the published 0.4.1, not on this version.

Readiness evidence

| Evidence | React | Vue |
| - | - | - |
| state | implemented-evidence-complete | implemented-evidence-complete |
| versioned contract | passed | passed |
| target implementation | passed | passed |
| package export | passed | passed |
| public declaration | passed | passed |
| dependency closure | passed | passed |
| framework scenario | passed | passed |
| accessibility | verified | verified |
| interaction | verified | verified |
| visual themes | verified | verified |

## Use your own

You can replace this component with your own React or Vue component. Map it, and generated code imports yours at the exact version you name. A contract report, run in a real browser, lists what your component met, what it didn't, and what wasn't checked.

The `component_map` call, with the parts in angle brackets yours to fill:

```
{
  "action": "create",
  "apply": true,
  "externalSystem": "<your design system>",
  "externalComponent": "<YourRoleAssignmentForm>",
  "oodsTraits": [
    "Authable"
  ],
  "substitution": {
    "component": "RoleAssignmentForm",
    "react": {
      "package": "<your-package>/react",
      "version": "<exact version>",
      "export": "<YourRoleAssignmentForm>"
    },
    "vue": {
      "package": "<your-package>/vue",
      "version": "<exact version>",
      "export": "<YourRoleAssignmentForm>"
    }
  }
}
```

## How this page was made

Generated at build from the published data, each source with the hash of what was read. [The page's manifest](https://oods-foundry.com/components/role-assignment-form/manifest.json).

- **Contract**: `@oods/component-contracts@0.10.1 componentContracts.RoleAssignmentForm` `sha256:12864e29600d…`
- **Documented example**: `@oods/component-contracts@0.10.1 sharedScenarios role-assignment-form-roles` `sha256:5c46ea6140dc…`
- **Catalog entry (catalog_list)**: `generated/0.10.1/system/catalog.json RoleAssignmentForm` `sha256:05c745c7951f…`
- **React readiness**: `@oods/components-react@0.10.1 readiness RoleAssignmentForm` `sha256:cada232934ab…`
- **Vue readiness**: `@oods/components-vue@0.10.1 readiness RoleAssignmentForm` `sha256:0c84c3de3f79…`
- **Prop types**: `generated/0.10.1/components/prop-types.json RoleAssignmentForm` `sha256:6f0a0a3e7327…`
