Skip to content

AI

AiPromptInput

Bit.BlazorUI.AIComposerChatInput

BitAiPromptInput is the composer of an AI chat: a text box that grows with what is typed, where Enter sends and Shift+Enter starts a new line; files picked, dragged or pasted in, all checked against one type filter, one size limit and one count; slash commands and mentions (typed after a / or an at sign) offered from a menu the arrow keys drive; optional dictation; and one button that sends, then stops the turn while it is in flight. Hand it a BitAiChatSession, or handle OnSubmit for a pipeline of your own.

Notes

To use this component, you need to install the Bit.BlazorUI.AI(opens in a new tab) nuget package, as described in the Optional steps of the Getting started page.

Register the services of the package with builder.Services.AddBitBlazorUIAIServices(ai => ai.UseTransport(...)). The composer sends what is submitted to its Session (a BitAiChatSession, which the BitAiChatSessionFactory service makes with the registered transport), or hands it to OnSubmit instead. Inside a BitAiChat it is already wired to the chat's session; see the attachments and commands and mentions scenarios for it at work there.

With commands or mentions to offer the text is a combobox (a plain text box otherwise): the menu is driven by the arrow keys while the focus stays in the text, a plain Enter or Tab accepts an option (with a modifier each keeps its own meaning: Shift+Enter breaks the line, Ctrl+Enter sends, Shift+Tab moves back), the menu closes as the focus leaves the text, and Escape closes the menu - or, with no menu open, stops the turn in flight - claiming the key, so a dialog around the composer stays open. The send button is named for what it does next (Send, then Stop), a file turned away is named in an alert, the focus goes back to the text when a staged file is removed, and the character count is announced politely once the limit is close.

The type, size and count of a file are checked in the browser before a byte of it is read, which keeps an oversized paste from costing anything - but it is the browser's word: check what reaches your server again there.

Two of the BitAiUiOptions in force shape the composer: SubmitOnEnter (true by default; false leaves Ctrl or Cmd with Enter to send) and MaxComposerRows (12), the most rows the text grows to before it scrolls. Its words come from the strings in force, which a BitAiOptionsProvider localizes: the placeholder (PromptPlaceholder), the names of the buttons (Send, Stop, AttachFile), the overlay of a drag (DropFiles), the names of the menu (Commands, Mentions), the counter (CharacterCount, CharactersRemaining) and the alert of the files turned away (AttachmentTooLarge, AttachmentTooMany, AttachmentTypeNotAllowed, AttachmentReadFailed, Dismiss).

Usage

Every example is live. Open its code to see exactly what produced the component running underneath.

Basic

Type and press Enter to send, Shift+Enter for a new line; the text grows up to 12 rows, then scrolls. OnSubmit receives a BitAiPromptSubmission - the trimmed text and the files staged with it - and the composer empties itself. Placeholder also names the text for assistive technologies, unless an AriaLabel is given. Enter alone stops sending (leaving Ctrl or Cmd with Enter) under a BitAiOptionsProvider whose options say SubmitOnEnter = false.



Sent: nothing yet

Value & MaxLength

@bind-Value keeps the text in your hands: set it to fill the composer in, read it as it is typed. MaxLength caps the text and shows a counter under it, which turns to the warning color as the limit gets close and is then announced politely. FocusAsync puts the caret in the composer.


Value:
Sent: nothing yet

Session

Given a Session and no OnSubmit, the composer submits to the session, and the send button becomes a stop button for as long as the session is generating - press it, or Escape, to stop the answer halfway. A BitAiMessageList of the same session shows the conversation.

Generating & OnStop

Without a session, Generating says whether a turn of your own is in flight and OnStop is raised when the user asks to stop it. Set, Generating also wins over the state of a Session.


Send something to start a turn of your own; it takes five seconds unless you stop it.

Attachments

Files come in three ways: the paperclip opens the picker, files dragged over the composer are dropped onto it, and a paste attaches what the clipboard holds - which is how a screenshot arrives. Each staged file is a BitAiAttachmentChip with a remove button, an image with a thumbnail made in the browser. The submission carries them in Attachments and owns them from then on. MaxInlineSize (256 KB by default, 64 KB here) is the largest file whose bytes are held in memory: a file within it carries them (Data, and a data URL as its Url), while a larger one stays in the browser and is read through its ContentFactory when something opens it (OpenReadAsync), so a Blazor Server circuit never holds megabytes per attachment - send a small and a large file to see both. AllowAttachments="false" turns all three ways off.



Sent: nothing yet

Limits & rejections

Accept filters the picker and is checked for pasted and dropped files too, which the browser does not filter. MaxAttachmentSize (10 MB by default) is checked before a byte is read, and MaxAttachments (20) caps how many are staged at once. A file turned away is never dropped silently: an alert in the composer, above the text, names it and says why, and OnAttachmentRejected hands your app a BitAiAttachmentRejection to log. This one takes images and PDFs, up to 1 MB and three at a time.


Sent: nothing yet

Turned away:
Nothing yet. Try a file over 1 MB, a fourth file, or a .txt file.

Dictation

AllowDictation adds a microphone, a BitAiVoiceInput: the provisional text shows under the text as you speak, and each finished phrase is added to it. DictationLanguage is the language listened for (the browser's when null). The microphone only appears where the browser has speech recognition (not in Firefox, for one), and the browser does the recognition - some (Chrome, for one) in their vendor's cloud service.


Sent: nothing yet

Model & capabilities

The Model a prompt is for decides what the composer offers: attachments only for a model that takes images, documents or audio, dictation only for one that takes audio, and the file types of the picker from what it takes. Capabilities stands in for a model record, or overrides its capabilities. Pick a model in the BitAiModelSelector: Demo Large takes images, the other two take no files at all - stage an image, then switch: the files the new model cannot take are taken off and named in the notice, rather than sent to a model that cannot read them.





Sent: nothing yet

Slash commands & mentions

A forward slash at the start of the text opens the Commands, an at sign anywhere the Mentions; typing on filters them, the arrow keys move through them, a plain Enter or Tab accepts and Escape closes the menu. A BitAiSlashCommand with a Template inserts it as text, one with a Handler runs app code instead (/clear empties the list above, without reaching the model). A BitAiMentionItem inserts its label, which your app resolves by its Id.

    Drafts

    A DraftKey keeps the text in the session storage of the browser, so a reload or a dropped circuit does not lose what was being written: it is restored when the composer first renders empty, saved on every change and cleared on submit. Type something and reload the page. Use a key per conversation, so drafts do not bleed between them.


    Sent: nothing yet

    Templates

    PrefixTemplate goes before the text - a model picker is the usual thing there - SuffixTemplate between the tools and the send button, and HintTemplate under the composer, beside the counter of a MaxLength.

    Enter to send, Shift+Enter for a new line. Answers can be wrong - check what matters.

    Sent: nothing yet

    Cascading parameters

    BitParams with a BitAiPromptInputParams sets what the composers of an app, or of one part of it, agree on: the files they take, their limits, their commands and mentions, their placeholder and look - here images only, two at a time, and 200 characters. A parameter of the composer itself still wins. The text, the session, the draft key, the model, the templates and the callbacks are each composer's own and cannot be cascaded.



    Sent: nothing yet

    Disabled

    A disabled composer takes no text and offers no commands or mentions, refuses a file pasted or dropped onto it (with no overlay and nothing read), and its attach, dictation and send buttons are disabled with it. Disabling it while the microphone is on stops the dictation.

    Style & Class

    Style and Class reach the root, the frame of the composer; Styles and Classes each part, down to the buttons (BitButtonClassStyles), the chips of the staged files and the alert of the rejected ones. The public --bit-AiPromptInput-* variables (see the CSS variables table) re-skin it from :root, an ancestor or Style; the buttons and the chips keep their own --bit-Button-* and --bit-Tag-* ones.






    Sent: nothing yet

    RTL

    In right-to-left text the composer is mirrored - the tools and the send button sit at its left end, the counter under them - and the send arrow points the way the text runs, whether the direction comes from Dir or from a dir attribute around the composer.

    برای ارسال Enter و برای خط جدید Shift+Enter را بزنید.


    Sent: nothing yet

    CSS variables

    The public custom properties this component reads off its root, for what no parameter covers.

    Every variable is read with a fallback and never declared by the component, so it inherits like any other custom property: set one on :root (or in a [bit-theme] block) to restyle every instance, on any ancestor to restyle the ones inside it, or on the Style of one instance to restyle it - and any instance nested inside it, which inherits the value too; a parameter changes one alone, as does the real CSS property on the instance's Style / Styles when that property does not inherit (opacity: 1 keeps one disabled instance undimmed without undimming a disabled one inside it), while an inherited one such as color or font-family also reaches the nested instances that do not set it themselves. Leave a variable unset and the component falls back to the theme token beside it.

    BitAiPromptInput CSS variables

    Name Default value Description
    --bit-AiPromptInput-background var(--bit-clr-bg-pri) Fill of the frame. A disabled composer is filled with --bit-AiPromptInput-disabled-background instead.
    --bit-AiPromptInput-border-color var(--bit-clr-brd-pri) Color of the frame. While files are dragged over the composer it is --bit-AiPromptInput-drop-color, and a disabled one takes the disabled border color of the theme.
    --bit-AiPromptInput-border-width var(--bit-shp-brd-width) Thickness of the frame.
    --bit-AiPromptInput-radius var(--bit-shp-radius-control) Corner of the frame, which the drop overlay follows.
    --bit-AiPromptInput-shadow none Elevation of the frame, kept under the focus ring while the focus is in the composer.
    --bit-AiPromptInput-padding spacing(1) Inset of the frame.
    --bit-AiPromptInput-gap spacing(1) Room between the rows inside the frame: the staged files, the alert, the text, the provisional dictation and the footer.
    --bit-AiPromptInput-focus-color the global focus ring Color of the ring drawn around the frame while the focus is anywhere in the composer (the text has no frame of its own).
    --bit-AiPromptInput-color var(--bit-clr-fg-pri) Color of the typed text and of the options of the menu. A disabled composer writes it in --bit-AiPromptInput-disabled-color instead.
    --bit-AiPromptInput-placeholder-color var(--bit-clr-fg-sec) Color of the placeholder.
    --bit-AiPromptInput-font-size var(--bit-tpg-fs-md) Size of the typed text.
    --bit-AiPromptInput-line-height 1.5 Leading of the typed text, the unit the growing text counts its rows in (up to the MaxComposerRows of BitAiUiOptions, 12 by default).
    --bit-AiPromptInput-drop-color var(--bit-clr-pri) Color of the dashed frame and of the text of the overlay while files are dragged over the composer.
    --bit-AiPromptInput-drop-background var(--bit-clr-bg-pri) at 86% Fill of the overlay shown while files are dragged over the composer.
    --bit-AiPromptInput-menu-background var(--bit-clr-bg-pri) Fill of the menu of commands and mentions.
    --bit-AiPromptInput-menu-border-color var(--bit-clr-brd-sec) Color of the rule around the menu.
    --bit-AiPromptInput-menu-shadow var(--bit-shd-popup) Elevation of the menu.
    --bit-AiPromptInput-menu-max-height var(--bit-siz-popup-max-height) Height past which the menu scrolls.
    --bit-AiPromptInput-item-hover-background var(--bit-clr-bg-pri-hover) Fill of the option under the pointer, and of the one the arrow keys have reached.
    --bit-AiPromptInput-hint-color var(--bit-clr-fg-sec) Color of the hint, the character counter, the descriptions of the options and the provisional dictation.
    --bit-AiPromptInput-near-limit-color var(--bit-clr-wrn) Color of the counter of a MaxLength once the text is close to it.
    --bit-AiPromptInput-over-limit-color var(--bit-clr-err) Color of the counter of a MaxLength once the text is past it.
    --bit-AiPromptInput-disabled-color var(--bit-clr-fg-dis) Color of the text and of the placeholder of a composer whose Disabled is true.
    --bit-AiPromptInput-disabled-background var(--bit-clr-bg-dis) Fill of the frame of a composer whose Disabled is true.

    API

    Every parameter, public member, sub-class and enum this component exposes.

    BitAiPromptInput parameters

    Name Type Default value Description
    Accept string? null The file types to accept, in the syntax of the HTML accept attribute: extensions such as .pdf, MIME types such as image/png, or wildcards such as image/*. Applied to the file picker and also checked for pasted and dropped files, which the browser does not filter. When null, the types follow the capabilities of the Model (or Capabilities) when one is given - image/* for Vision, audio/* for Audio, application/pdf, .pdf and text/* for Documents - and every type is accepted otherwise. A file already staged that the accepted types no longer take - another model was picked - is taken off and named in the alert, as a file turned away (TypeNotAllowed).
    AllowAttachments bool true Offers the attach button and accepts dropped or pasted files. A Model (or Capabilities) declaring none of Vision, Documents and Audio hides them whatever this says.
    AllowDictation bool false Offers the dictation button (a BitAiVoiceInput) where the browser has speech recognition; it renders nothing where it has none. A Model (or Capabilities) that does not declare Audio hides it. Each finished phrase is appended to the text (cut at MaxLength), and the provisional one is shown under the text meanwhile.
    Capabilities BitAiModelCapabilities? null The capabilities to assume when there is no Model record, or to use in place of the capabilities of the one there is. They decide whether attachments and dictation are offered and which file types the picker accepts.
    Classes BitAiPromptInputClassStyles? null Custom CSS classes for different parts of the prompt input.
    Commands IReadOnlyList<BitAiSlashCommand>? null The commands offered when the user types a forward slash at the start of the text, filtered by what is typed after it. Choosing one inserts its Template, or runs its Handler instead.
    DictationLanguage string? null The dictation language, as a BCP 47 language tag such as en-US. When null, the language of the browser is used.
    DraftKey string? null A key under which the draft text is kept in the session storage of the browser, so it survives a reload or a dropped circuit. It is restored when the composer first renders with an empty value, saved on every change and cleared on submit. Use a key that identifies the conversation, so drafts do not bleed between them. Drafts are not kept when it is null.
    Generating bool? null Whether a turn is in flight, which turns the send button into a stop button and lets Escape stop the turn. When null, the state of the Session is used.
    HintTemplate RenderFragment? null A hint rendered under the composer, beside the character counter of a MaxLength.
    MaxAttachmentSize long 10 * 1024 * 1024 The largest file the composer stages, in bytes (10 MB by default, DefaultMaxAttachmentSize). Checked in the browser before a pasted or dropped file is read, so an oversized file costs nothing to turn away. The files within it are streamed rather than sent in one message, so it is not tied to the SignalR message size of Blazor Server.
    MaxAttachments int 20 The most files that can be staged at once (DefaultMaxAttachments). A file past it is turned away as TooMany.
    MaxInlineSize long 256 * 1024 The largest file whose bytes are held in memory, in bytes (256 KB by default, DefaultMaxInlineSize). A file within it is buffered and carries BitAiAttachment.Data and a data URL; a larger one is kept in the browser and read through BitAiAttachment.ContentFactory when something opens it, so a circuit never holds megabytes per attachment. Image thumbnails are object URLs made in the browser either way.
    MaxLength int? null The most characters the text may hold. Enforced by the textarea and shown as a counter under the composer, which turns to the warning color as the limit gets close and is then announced politely. A text past it (set through Value) cannot be sent. When null, the text is unlimited.
    Mentions IReadOnlyList<BitAiMentionItem>? null The items offered when the user types an at sign, filtered by what is typed after it. Choosing one inserts @ and its label.
    Model BitAiModel? null The model the prompt is for. Its capabilities (unless Capabilities is set) decide whether attachments and dictation are offered and which file types the picker accepts.
    OnAttachmentRejected EventCallback<BitAiAttachmentRejection> Raised for each file the composer turns away: too large, too many, not an accepted type, or unreadable. The composer already tells the user with an alert above the text (the last three files it turned away); handle this to log the rejection or to offer another route, such as uploading the file to the app's own storage.
    OnStop EventCallback Raised when the user asks to stop the current turn: the stop button, or Escape in the text. The Session, when there is one, is stopped first.
    OnSubmit EventCallback<BitAiPromptSubmission> Raised when the user submits, with the trimmed text and the staged attachments; the composer then empties itself. When it is not set, the submission goes to the Session.
    Placeholder string? null The placeholder of the text, which also names it for assistive technologies unless an AriaLabel is given. When null, the PromptPlaceholder of the strings in force is used ("Send a message...").
    PrefixTemplate RenderFragment? null The content placed before the text, such as a model picker.
    Session BitAiChatSession? null The session, which supplies the generation state (unless Generating is set) and receives the submissions while OnSubmit is not set. Stopping a turn stops it.
    Styles BitAiPromptInputClassStyles? null Custom CSS styles for different parts of the prompt input.
    SuffixTemplate RenderFragment? null The content placed between the tools (the attach and dictation buttons) and the send button.
    Value string string.Empty The text of the composer. Use @bind-Value to keep it in step.
    ValueChanged EventCallback<string> Raised whenever the text changes - typed, dictated, inserted from the menu, restored from a draft or emptied on submit - so the value can be bound.

    BitAiPromptInput public members

    Name Type Default value Description
    Attachments IReadOnlyList<BitAiAttachment> [] The attachments currently staged in the composer.
    EffectiveCapabilities BitAiModelCapabilities? null The capabilities in force: Capabilities, else those of Model, else null (everything offered).
    FocusAsync ValueTask Puts the caret in the text of the composer.
    DefaultMaxAttachmentSize const long 10 * 1024 * 1024 The default of MaxAttachmentSize: 10 MB.
    DefaultMaxAttachments const int 20 The default of MaxAttachments.
    DefaultMaxInlineSize const long 256 * 1024 The default of MaxInlineSize: 256 KB.

    BitComponentBase parameters

    Name Type Default value Description
    AriaLabel string? null Gets or sets the accessible label for the component, used by assistive technologies.
    Class string? null Gets or sets the CSS class name(s) to apply to the rendered element.
    Dir BitDir? null Gets or sets the text directionality for the component's content.
    Disabled bool false Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction.
    ForceAnimation bool false Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested.
    HtmlAttributes Dictionary<string, object> new Dictionary<string, object>() Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. An attribute written on the component wins over an entry of the same name.
    Id string? null Gets or sets the unique identifier for the component's root element.
    Style string? null Gets or sets the CSS style string to apply to the rendered element.
    TabIndex string? null Gets or sets the tab order index for the component when navigating with the keyboard.
    Visibility BitVisibility BitVisibility.Visible Gets or sets the visibility state (visible, hidden, or collapsed) of the component.

    BitComponentBase public members

    Name Type Default value Description
    UniqueId Guid Guid.NewGuid() Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed.
    RootElement ElementReference Gets the reference to the root HTML element associated with this component.

    BitAiPromptInputClassStyles properties

    Name Type Default value Description
    Root string? null Custom CSS classes/styles for the root element of the BitAiPromptInput, the frame of the composer.
    DropOverlay string? null Custom CSS classes/styles for the overlay of the BitAiPromptInput shown while files are dragged over it.
    Attachments string? null Custom CSS classes/styles for the list of the staged attachments of the BitAiPromptInput.
    AttachmentChip BitAiAttachmentChipClassStyles? null Custom CSS classes/styles for each BitAiAttachmentChip of the staged attachments of the BitAiPromptInput.
    Notice BitMessageClassStyles? null Custom CSS classes/styles for the BitMessage of the BitAiPromptInput that names the files it turned away.
    Menu string? null Custom CSS classes/styles for the menu of the slash commands and the mentions of the BitAiPromptInput.
    MenuItem string? null Custom CSS classes/styles for each option of the menu of the BitAiPromptInput.
    MenuItemIcon string? null Custom CSS classes/styles for the icon of each option of the menu of the BitAiPromptInput.
    MenuItemLabel string? null Custom CSS classes/styles for the label of each option of the menu of the BitAiPromptInput.
    MenuItemHint string? null Custom CSS classes/styles for the description of each option of the menu of the BitAiPromptInput.
    Body string? null Custom CSS classes/styles for the row of the BitAiPromptInput that holds the prefix, the text and the tools.
    Prefix string? null Custom CSS classes/styles for the container of the PrefixTemplate of the BitAiPromptInput.
    Input string? null Custom CSS classes/styles for the textarea of the BitAiPromptInput.
    Tools string? null Custom CSS classes/styles for the container of the tools of the BitAiPromptInput: the attach button, the dictation, the SuffixTemplate and the send button.
    AttachButton BitButtonClassStyles? null Custom CSS classes/styles for the BitButton of the BitAiPromptInput that opens the file picker.
    VoiceInput BitAiVoiceInputClassStyles? null Custom CSS classes/styles for the BitAiVoiceInput of the BitAiPromptInput.
    SendButton BitButtonClassStyles? null Custom CSS classes/styles for the BitButton of the BitAiPromptInput that sends the prompt, or stops the turn in flight.
    Interim string? null Custom CSS classes/styles for the provisional text of the dictation of the BitAiPromptInput.
    Footer string? null Custom CSS classes/styles for the footer of the BitAiPromptInput that holds the hint and the character counter.
    Hint string? null Custom CSS classes/styles for the hint of the BitAiPromptInput.
    Counter string? null Custom CSS classes/styles for the character counter of the BitAiPromptInput.
    LiveRegion string? null Custom CSS classes/styles for the visually hidden live region of the BitAiPromptInput that announces the characters left once the limit is close.

    BitAiSlashCommand properties

    A command offered when the user types a forward slash at the start of the text: new BitAiSlashCommand(name, description, icon) { Template = ... } or { Handler = ... }. A Template suits a prompt shortcut, a Handler an app action - clearing the conversation, regenerating the answer - that never reaches the model.

    Name Type Default value Description
    Name string The command word, without the slash. It is what the text typed after the slash is matched against (case-insensitively, anywhere in it), and the menu shows it as /Name.
    Description string? null What it does, shown beside the name.
    Icon string? null The name of a Fluent UI icon of the built-in set (BitIconName), shown before the name.
    Template string? null Text that replaces the slash and what was typed after it when the command is chosen; the caret lands at its end. When null (and there is no Handler), "/Name " is inserted.
    Handler Func<Task>? null Invoked when the command is chosen, instead of inserting text: the slash and what was typed after it are removed from the text first. It runs inside the composer's own event, so a handler that changes the state of the page renders the page itself (StateHasChanged).

    BitAiMentionItem properties

    Something the user can reference by typing an at sign - a file, a person, a data source: new BitAiMentionItem(id, label, description, icon). The composer inserts the label; resolving it to content is the app's job, done by Id rather than by asking the model to guess what was meant.

    Name Type Default value Description
    Id string The stable identifier the app resolves the mention by later.
    Label string What the user sees, what the text typed after the at sign is matched against, and what is inserted ("@Label ").
    Description string? null Extra detail shown beside the label.
    Icon string? null The name of a Fluent UI icon of the built-in set (BitIconName), shown before the label.

    BitAiPromptSubmission properties

    What the composer hands OnSubmit when the user submits. The submission owns the attachments from then on: the composer no longer releases their browser streams or previews when it is discarded.

    Name Type Default value Description
    Text string The trimmed text. It may be empty when attachments carry the request.
    Attachments IReadOnlyList<BitAiAttachment> The files staged alongside it.

    BitAiAttachmentRejection properties

    A file the composer did not stage, and why - the same thing the alert in the composer, above the text, tells the user, for the app to log or to offer another route for, such as uploading the file to its own storage.

    Name Type Default value Description
    FileName string The file name. It is empty when the picker handed over more files than could be read at all.
    ContentType string The MIME type the browser reported, which may be empty.
    Size long The size in bytes.
    Reason BitAiAttachmentRejectionReason Why the file was turned away.

    BitAiComposerFile properties

    A file the browser hands the composer from a paste or a drop: described first, its bytes streamed only when they are read, since one interop message carrying a whole file would exceed the SignalR message limit of Blazor Server (32 KB by default). The composer makes BitAiAttachments of these itself, so an app rarely meets the type: it is public because the script of the composer calls into it, and for an app that gets the bytes of a file in the browser its own way - new BitAiComposerFile(name, contentType, size, base64).ToAttachment() makes a BitAiAttachment of one sent inline, and ToAttachmentAsync one whose Content is an IJSStreamReference of its own JS interop - to hand to a session or a message itself.

    Name Type Default value Description
    Name string The file name.
    ContentType string The MIME type.
    Size long The size in bytes.
    Data string? null The content, base64 encoded, when it was sent inline. The browser helpers send Content instead.
    Content IJSStreamReference? null The content as a browser stream, or null when it was sent inline in Data or withheld because the file was over the size limit.
    PreviewUrl string? null A short object URL (URL.createObjectURL) for the preview of an image, or null for any other file. It becomes the ThumbnailUrl of the attachment: the bytes stay in the browser, only the URL crosses the circuit.
    ToAttachment() BitAiAttachment Converts a file sent inline (Data) into an attachment with its content as a data URL. Throws an InvalidOperationException for a file that was not sent inline.
    ToAttachmentAsync(long maxAllowedSize, long maxInlineSize, CancellationToken cancellationToken) Task<BitAiAttachment> Turns the file into an attachment: buffered, with the content as a data URL, when it is no larger than maxInlineSize (everything by default), and otherwise read on demand through BitAiAttachment.ContentFactory. A longer stream than maxAllowedSize fails the read. A buffered file releases the browser stream; a lazy one keeps it, and the caller releases it when the attachment is discarded.

    BitAiAttachmentRejectionReason enum

    Name Value Description
    TooLarge 0 The file is larger than MaxAttachmentSize.
    TypeNotAllowed 1 The file does not match Accept (or the types the capabilities of the model take) - or a staged file no longer does, once the accepted types moved under it (another model was picked).
    ReadFailed 2 The browser could not deliver the content, or the transfer was interrupted.
    TooMany 3 Staging the file would exceed MaxAttachments.

    BitVisibility enum

    Name Value Description
    Visible 0 The content of the component is visible.
    Hidden 1 The content of the component is hidden, but the space it takes on the page remains (visibility:hidden).
    Collapsed 2 The component is hidden (display:none).

    BitDir enum

    Name Value Description
    Ltr 0 Ltr (left to right) is to be used for languages that are written from the left to the right (like English).
    Rtl 1 Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic).
    Auto 2 Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element.

    Feedback

    Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.