MessageView.UserCode
The style definition for the "user code message view", used to display recovery codes in a 2-column monospace grid.
Multiple userCode messages received from the server are aggregated into a single MessageView.UserCode container, regardless of their order in the response.
Interaction
Unlike other MessageView styles (which support long-press to copy via UIEditMenuInteraction), the userCode style shows an explicit "Copy codes" button below the grid. Tapping it copies all codes to the clipboard immediately (newline-separated), without presenting an intermediate system menu. The long-press gesture is not active for this style.
The copy button icon defaults to the SF Symbol doc.on.doc. Set imageName in your theme override to use a custom image from your asset catalog instead.
Style keys
| Key | Type | Description |
|---|---|---|
| alignment | String | The vertical alignment of the content. The default value is center. |
| backgroundColorName | String | The color name for the background that references a color in the asset catalog of the application. The default value is hui_message_view_info_background. |
| borderColorName | String | The color name for the border that references a color in the asset catalog of the application. The default value is hui_grey_immutable. |
| borderWidth | Number | The width of the border. The default value is 1. |
| cornerRadius | Number | The radius of the corner. The default value is 6. |
| iconTextPadding | Number | The spacing between the icon and the text, and also the inter-row and button spacing in the grid. The default value is 8. |
| imageName | String | The name of the image used as the copy button icon, referencing an image in the asset catalog. Omitting this value uses the default doc.on.doc SF Symbol. |
| imageTintColorName | String | The color name for the copy button icon tint, referencing a color in the asset catalog. The default value is hui_text_headings. |
| paddingBottom | Number | The bottom padding. The default value is 12. |
| paddingLeft | Number | The left padding. The default value is 12. |
| paddingRight | Number | The right padding. The default value is 12. |
| paddingTop | Number | The top padding. The default value is 12. |
| textAppearance | String | The text appearance for the code labels and copy button. The default value is TextAppearance.UserCode, which applies a monospace font. |
| textColorName | String | The color name for the text that references a color in the asset catalog. The default value is hui_text_headings. |