Atlassian Design System JS behaviour

Inline Message

A small colored icon plus short text sitting right inside forms and content — help or error explained at the exact spot it happens.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

The explanation at the exact spot

Type into the invite field — a malformed address raises the error, a teammate who is already in raises the warning, and a valid send ends in the green confirmation.

Invite to Nabu platform Teammates get an email and land on the board directly.

New members join as developersThe role stays changeable per member, any time.
3 current members: Ali, Sara, Maryam
hosein@nabu.example sara@nabu.example no-domain@

All five appearances

Only the icon colour changes — the icon itself stays round, the text stays one short line, the message stays where the reader is.

InfoBoard cards now support keyboard drag. info
ConfirmationBackups finished at 03:00 — 12.4 GB kept. confirmation
WarningThe last two builds ran without tests. warning
ErrorThe deploy to production failed at step 4. error
DiscoveryAutomation rules just landed in your workspace. discovery

Important props

Important props
Prop Type Default What it does
appearance string 'info' info · confirmation · warning · error · discovery; only the icon colour changes.
title string '' The semibold text beside the icon; always one line.
secondaryText string null The quieter text under the title for extra detail.

Snippet

<span class="atim" data-tone="error">
    <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 8v5M12 16.5v.5"/></svg>
    <span><b>This email is already registered</b><small>Try a different address.</small></span>
</span>

<style>
.atim { display: inline-flex; gap: 8px; max-inline-size: 100%; }
.atim svg { inline-size: 16px; flex: none; margin-block-start: 1px; stroke: #CA3521;
            fill: none; stroke-width: 2; stroke-linecap: round; }
.atim b { display: block; font: 600 12px/1.5 Inter, system-ui; color: #172B4D; }
.atim small { display: block; font: 400 12px/1.5 Inter, system-ui; color: #626F86; }
</style>
// app/Pages/Invite.jsx — Inertia page; renders the React snippet
// below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import InviteField from '@/components/InviteField';

export default function Invite() {
  return (
    <NabuXUIProvider locale="en" linkComponent={Link}>
      <main className="nx-page">
        <InviteField />
      </main>
    </NabuXUIProvider>
  );
}
// InviteField.jsx — inline message: help or error at the exact spot it happens
import { useState } from 'react';
import '@nabuxai/ui-core/css';

const EXISTING = ['lena@nabu.example', 'marco@nabu.example'];
const ICONS = {
  error: 'M12 8v5M12 16.5v.5',
  warning: 'M12 6v7M12 16.5v.5',
  confirmation: 'M5 12l5 5L20 7',
};
const INK = { error: '#CA3521', warning: '#A54800', confirmation: '#1F845A' };
const COPY = {
  error: ['This address is not valid', 'Check for typos and try again.'],
  warning: ['This teammate is already in', 'They will not get a second invite.'],
  confirmation: ['Invite sent', 'They will see the workspace on next sign-in.'],
};

export default function InviteField() {
  const [email, setEmail] = useState('');
  const [sent, setSent] = useState(false);

  // Only the icon colour changes between the five appearances.
  const state = !email.trim() ? 'idle'
    : !/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email.trim().toLowerCase()) ? 'error'
    : EXISTING.includes(email.trim().toLowerCase()) ? 'warning' : 'ok';

  const send = () => { if (state === 'ok') { setSent(true); setEmail(''); } };
  const msg = (tone) => (
    <span className="atim" data-tone={tone}>
      <svg viewBox="0 0 24 24" aria-hidden="true" style={{ stroke: INK[tone] }}>
        <circle cx="12" cy="12" r="10" /><path d={ICONS[tone]} />
      </svg>
      <span><b>{COPY[tone][0]}</b><small>{COPY[tone][1]}</small></span>
    </span>
  );

  return (
    <>
      <style>{`
        .atim-panel { display: grid; gap: .5rem; max-inline-size: 22rem; padding: 1.25rem;
                      border: 1px solid #DFE1E6; border-radius: 6px; background: #fff;
                      font-family: Inter, system-ui, sans-serif; }
        .atim-panel label { font: 500 .78rem Inter, system-ui; color: #44546F; }
        .atim-panel input { inline-size: 100%; box-sizing: border-box; block-size: 2.25rem;
                            padding-inline: .65rem; border: 1px solid #DFE1E6; border-radius: 4px;
                            font: 400 .85rem Inter, system-ui; }
        .atim-panel input[data-state='error'] { border-color: #CA3521; }
        .atim { display: inline-flex; gap: .5rem; align-items: flex-start; }
        .atim svg { flex: none; inline-size: 1rem; block-size: 1rem; margin-block-start: .1rem;
                    fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
        .atim b { display: block; font: 600 .78rem/1.5 Inter, system-ui; color: #172B4D; }
        .atim small { display: block; font: 400 .74rem/1.5 Inter, system-ui; color: #626F86; }
        .atim-btn { justify-self: start; block-size: 2rem; padding-inline: .8rem; border: none;
                    border-radius: 3px; cursor: pointer; background: #0C66E4; color: #fff;
                    font: 500 .8rem/1 Inter, system-ui; }
        .atim-btn:disabled { cursor: not-allowed; background: #A5ADBA; }
      `}</style>
      <div className="atim-panel">
        <label htmlFor="invite">Invite by email</label>
        <input id="invite" type="email" value={email} placeholder="teammate@company.com"
          data-state={state === 'error' ? 'error' : undefined}
          onChange={(e) => { setEmail(e.target.value); setSent(false); }} />
        {/* The message sits exactly where the mistake happens. */}
        {(state === 'error' || state === 'warning') && msg(state)}
        {sent && msg('confirmation')}
        <button type="button" className="atim-btn" disabled={state !== 'ok'} onClick={send}>
          Send invite
        </button>
      </div>
    </>
  );
}
<!-- InviteField.vue — inline message: help or error at the exact spot it happens -->
<script setup lang="ts">
import { computed, ref } from 'vue';
import '@nabuxai/ui-core/css';

const existing = ['lena@nabu.example', 'marco@nabu.example'];
const icons = { error: 'M12 8v5M12 16.5v.5', warning: 'M12 6v7M12 16.5v.5', confirmation: 'M5 12l5 5L20 7' };
const ink = { error: '#CA3521', warning: '#A54800', confirmation: '#1F845A' };
const copy = {
  error: ['This address is not valid', 'Check for typos and try again.'],
  warning: ['This teammate is already in', 'They will not get a second invite.'],
  confirmation: ['Invite sent', 'They will see the workspace on next sign-in.'],
};

const email = ref('');
const sent = ref(false);
// Only the icon colour changes between the five appearances.
const state = computed(() => {
  const v = email.value.trim().toLowerCase();
  if (!v) return 'idle';
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(v)) return 'error';
  if (existing.includes(v)) return 'warning';
  return 'ok';
});
function send() {
  if (state.value !== 'ok') return;
  sent.value = true;
  email.value = '';
}
</script>

<template>
  <div class="atim-panel">
    <label for="invite">Invite by email</label>
    <input id="invite" v-model="email" type="email" placeholder="teammate@company.com"
      :data-state="state === 'error' ? 'error' : undefined" @input="sent = false" />
    <!-- The message sits exactly where the mistake happens. -->
    <span v-if="state === 'error' || state === 'warning'" class="atim" :data-tone="state">
      <svg viewBox="0 0 24 24" aria-hidden="true" :style="{ stroke: ink[state] }">
        <circle cx="12" cy="12" r="10" /><path :d="icons[state]" />
      </svg>
      <span><b>{{ copy[state][0] }}</b><small>{{ copy[state][1] }}</small></span>
    </span>
    <span v-if="sent" class="atim" data-tone="confirmation">
      <svg viewBox="0 0 24 24" aria-hidden="true" :style="{ stroke: ink.confirmation }">
        <circle cx="12" cy="12" r="10" /><path :d="icons.confirmation" />
      </svg>
      <span><b>{{ copy.confirmation[0] }}</b><small>{{ copy.confirmation[1] }}</small></span>
    </span>
    <button type="button" class="atim-btn" :disabled="state !== 'ok'" @click="send">Send invite</button>
  </div>
</template>

<style scoped>
.atim-panel { display: grid; gap: .5rem; max-inline-size: 22rem; padding: 1.25rem;
              border: 1px solid #DFE1E6; border-radius: 6px; background: #fff;
              font-family: Inter, system-ui, sans-serif; }
.atim-panel label { font: 500 .78rem Inter, system-ui; color: #44546F; }
.atim-panel input { inline-size: 100%; box-sizing: border-box; block-size: 2.25rem;
                    padding-inline: .65rem; border: 1px solid #DFE1E6; border-radius: 4px;
                    font: 400 .85rem Inter, system-ui; }
.atim-panel input[data-state='error'] { border-color: #CA3521; }
.atim { display: inline-flex; gap: .5rem; align-items: flex-start; }
.atim svg { flex: none; inline-size: 1rem; block-size: 1rem; margin-block-start: .1rem;
            fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.atim b { display: block; font: 600 .78rem/1.5 Inter, system-ui; color: #172B4D; }
.atim small { display: block; font: 400 .74rem/1.5 Inter, system-ui; color: #626F86; }
.atim-btn { justify-self: start; block-size: 2rem; padding-inline: .8rem; border: none;
            border-radius: 3px; cursor: pointer; background: #0C66E4; color: #fff;
            font: 500 .8rem/1 Inter, system-ui; }
.atim-btn:disabled { cursor: not-allowed; background: #A5ADBA; }
</style>
<!-- InviteField.svelte — inline message: help or error at the exact spot it happens -->
<script lang="ts">
  import '@nabuxai/ui-core/css';

  const existing = ['lena@nabu.example', 'marco@nabu.example'];
  const icons = { error: 'M12 8v5M12 16.5v.5', warning: 'M12 6v7M12 16.5v.5', confirmation: 'M5 12l5 5L20 7' };
  const ink = { error: '#CA3521', warning: '#A54800', confirmation: '#1F845A' };
  const copy = {
    error: ['This address is not valid', 'Check for typos and try again.'],
    warning: ['This teammate is already in', 'They will not get a second invite.'],
    confirmation: ['Invite sent', 'They will see the workspace on next sign-in.'],
  };

  let email = $state('');
  let sent = $state(false);
  // Only the icon colour changes between the five appearances.
  const state = $derived.by(() => {
    const v = email.trim().toLowerCase();
    if (!v) return 'idle';
    if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(v)) return 'error';
    if (existing.includes(v)) return 'warning';
    return 'ok';
  });

  function send() {
    if (state !== 'ok') return;
    sent = true;
    email = '';
  }
</script>

<div class="atim-panel">
  <label for="invite">Invite by email</label>
  <input id="invite" type="email" bind:value={email} placeholder="teammate@company.com"
    data-state={state === 'error' ? 'error' : undefined} oninput={() => (sent = false)} />
  <!-- The message sits exactly where the mistake happens. -->
  {#if state === 'error' || state === 'warning'}
    <span class="atim" data-tone={state}>
      <svg viewBox="0 0 24 24" aria-hidden="true" style:stroke={ink[state]}>
        <circle cx="12" cy="12" r="10" /><path d={icons[state]} />
      </svg>
      <span><b>{copy[state][0]}</b><small>{copy[state][1]}</small></span>
    </span>
  {/if}
  {#if sent}
    <span class="atim" data-tone="confirmation">
      <svg viewBox="0 0 24 24" aria-hidden="true" style:stroke={ink.confirmation}>
        <circle cx="12" cy="12" r="10" /><path d={icons.confirmation} />
      </svg>
      <span><b>{copy.confirmation[0]}</b><small>{copy.confirmation[1]}</small></span>
    </span>
  {/if}
  <button type="button" class="atim-btn" disabled={state !== 'ok'} onclick={send}>Send invite</button>
</div>

<style>
.atim-panel { display: grid; gap: .5rem; max-inline-size: 22rem; padding: 1.25rem;
              border: 1px solid #DFE1E6; border-radius: 6px; background: #fff;
              font-family: Inter, system-ui, sans-serif; }
.atim-panel label { font: 500 .78rem Inter, system-ui; color: #44546F; }
.atim-panel input { inline-size: 100%; box-sizing: border-box; block-size: 2.25rem;
                    padding-inline: .65rem; border: 1px solid #DFE1E6; border-radius: 4px;
                    font: 400 .85rem Inter, system-ui; }
.atim-panel input[data-state='error'] { border-color: #CA3521; }
.atim { display: inline-flex; gap: .5rem; align-items: flex-start; }
.atim svg { flex: none; inline-size: 1rem; block-size: 1rem; margin-block-start: .1rem;
            fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.atim b { display: block; font: 600 .78rem/1.5 Inter, system-ui; color: #172B4D; }
.atim small { display: block; font: 400 .74rem/1.5 Inter, system-ui; color: #626F86; }
.atim-btn { justify-self: start; block-size: 2rem; padding-inline: .8rem; border: none;
            border-radius: 3px; cursor: pointer; background: #0C66E4; color: #fff;
            font: 500 .8rem/1 Inter, system-ui; }
.atim-btn:disabled { cursor: not-allowed; background: #A5ADBA; }
</style>