Chat bubble | jaspr_daisyui_components
jaspr_daisyui_components
pub.dev ↗

Chat bubble

Chat bubbles are used to show one line of conversation and all its data, including the author image, author name, time, etc.

Class name Type Description
chat Component Container for one line of conversation and its data
chat-image Part Author image
chat-header Part Text above the chat bubble
chat-footer Part Text below the chat bubble
chat-bubble Part Chat bubble
chat-start Placement Aligns chat to start horizontally (required)
chat-end Placement Aligns chat to end horizontally (required)
chat-bubble-neutral Color neutral color for chat-bubble
chat-bubble-primary Color primary color for chat-bubble
chat-bubble-secondary Color secondary color for chat-bubble
chat-bubble-accent Color accent color for chat-bubble
chat-bubble-info Color info color for chat-bubble
chat-bubble-success Color success color for chat-bubble
chat-bubble-warning Color warning color for chat-bubble
chat-bubble-error Color error color for chat-bubble

chat-start and chat-end

It's over Anakin,
I have the high ground.
You underestimate my power!
<div class="chat chat-start">
  <div class="chat-bubble">
    It's over Anakin,
    <br />
    I have the high ground.
  </div>
</div>
<div class="chat chat-end">
  <div class="chat-bubble">You underestimate my power!</div>
</div>
Component.fragment([
  Chat(
    [
      ChatBubble(
        [
          Component.text('It\'s over Anakin,'),
          br(),
          Component.text('I have the high ground.'),
        ],
      ),
    ],
    placement: ChatPlacement.start,
  ),
  Chat([ChatBubble([Component.text('You underestimate my power!')])], placement: ChatPlacement.end),
]);

Chat with image

Tailwind CSS chat bubble component
It was said that you would, destroy the Sith, not join them.
Tailwind CSS chat bubble component
It was you who would bring balance to the Force
Tailwind CSS chat bubble component
Not leave it in Darkness
<div class="chat chat-start">
  <div class="chat-image avatar">
    <div class="w-10 rounded-full">
      <img alt="Tailwind CSS chat bubble component" src="https://img.daisyui.com/images/profile/demo/kenobee@192.webp" />
    </div>
  </div>
  <div class="chat-bubble">It was said that you would, destroy the Sith, not join them.</div>
</div>
<div class="chat chat-start">
  <div class="chat-image avatar">
    <div class="w-10 rounded-full">
      <img alt="Tailwind CSS chat bubble component" src="https://img.daisyui.com/images/profile/demo/kenobee@192.webp" />
    </div>
  </div>
  <div class="chat-bubble">It was you who would bring balance to the Force</div>
</div>
<div class="chat chat-start">
  <div class="chat-image avatar">
    <div class="w-10 rounded-full">
      <img alt="Tailwind CSS chat bubble component" src="https://img.daisyui.com/images/profile/demo/kenobee@192.webp" />
    </div>
  </div>
  <div class="chat-bubble">Not leave it in Darkness</div>
</div>
Component.fragment([
  Chat(
    [
      ChatImage(
        [
          div(
            [
              img(
                src: 'https://img.daisyui.com/images/profile/demo/kenobee@192.webp',
                alt: 'Tailwind CSS chat bubble component',
              ),
            ],
            classes: 'w-10 rounded-full',
          ),
        ],
        classes: 'avatar',
      ),
      ChatBubble([Component.text('It was said that you would, destroy the Sith, not join them.')]),
    ],
    placement: ChatPlacement.start,
  ),
  Chat(
    [
      ChatImage(
        [
          div(
            [
              img(
                src: 'https://img.daisyui.com/images/profile/demo/kenobee@192.webp',
                alt: 'Tailwind CSS chat bubble component',
              ),
            ],
            classes: 'w-10 rounded-full',
          ),
        ],
        classes: 'avatar',
      ),
      ChatBubble([Component.text('It was you who would bring balance to the Force')]),
    ],
    placement: ChatPlacement.start,
  ),
  Chat(
    [
      ChatImage(
        [
          div(
            [
              img(
                src: 'https://img.daisyui.com/images/profile/demo/kenobee@192.webp',
                alt: 'Tailwind CSS chat bubble component',
              ),
            ],
            classes: 'w-10 rounded-full',
          ),
        ],
        classes: 'avatar',
      ),
      ChatBubble([Component.text('Not leave it in Darkness')]),
    ],
    placement: ChatPlacement.start,
  ),
]);

Chat Bubble with colors

What kind of nonsense is this
Put me on the Council and not make me a Master!??
That's never been done in the history of the Jedi.
It's insulting!
Calm down, Anakin.
You have been given a great honor.
To be on the Council at your age.
It's never happened before.
<div class="chat chat-start">
  <div class="chat-bubble chat-bubble-primary">What kind of nonsense is this</div>
</div>
<div class="chat chat-start">
  <div class="chat-bubble chat-bubble-secondary">Put me on the Council and not make me a Master!??</div>
</div>
<div class="chat chat-start">
  <div class="chat-bubble chat-bubble-accent">That's never been done in the history of the Jedi.</div>
</div>
<div class="chat chat-start">
  <div class="chat-bubble chat-bubble-neutral">It's insulting!</div>
</div>
<div class="chat chat-end">
  <div class="chat-bubble chat-bubble-info">Calm down, Anakin.</div>
</div>
<div class="chat chat-end">
  <div class="chat-bubble chat-bubble-success">You have been given a great honor.</div>
</div>
<div class="chat chat-end">
  <div class="chat-bubble chat-bubble-warning">To be on the Council at your age.</div>
</div>
<div class="chat chat-end">
  <div class="chat-bubble chat-bubble-error">It's never happened before.</div>
</div>
Component.fragment([
  Chat(
    [
      ChatBubble([Component.text('What kind of nonsense is this')], color: ChatBubbleColor.primary),
    ],
    placement: ChatPlacement.start,
  ),
  Chat(
    [
      ChatBubble(
        [Component.text('Put me on the Council and not make me a Master!??')],
        color: ChatBubbleColor.secondary,
      ),
    ],
    placement: ChatPlacement.start,
  ),
  Chat(
    [
      ChatBubble(
        [Component.text('That\'s never been done in the history of the Jedi.')],
        color: ChatBubbleColor.accent,
      ),
    ],
    placement: ChatPlacement.start,
  ),
  Chat(
    [
      ChatBubble([Component.text('It\'s insulting!')], color: ChatBubbleColor.neutral),
    ],
    placement: ChatPlacement.start,
  ),
  Chat(
    [ChatBubble([Component.text('Calm down, Anakin.')], color: ChatBubbleColor.info)],
    placement: ChatPlacement.end,
  ),
  Chat(
    [
      ChatBubble(
        [Component.text('You have been given a great honor.')],
        color: ChatBubbleColor.success,
      ),
    ],
    placement: ChatPlacement.end,
  ),
  Chat(
    [
      ChatBubble(
        [Component.text('To be on the Council at your age.')],
        color: ChatBubbleColor.warning,
      ),
    ],
    placement: ChatPlacement.end,
  ),
  Chat(
    [
      ChatBubble([Component.text('It\'s never happened before.')], color: ChatBubbleColor.error),
    ],
    placement: ChatPlacement.end,
  ),
]);