Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
467a751
refactor: replace markdown-editor with native vaadin markdown
Totremont Jun 30, 2026
6f66d4c
build: remove the markdown-editor-addon dependency
Totremont Jun 30, 2026
dd97199
build: bump development version to 5.1.0-SNAPSHOT
Totremont Jun 30, 2026
c67d707
feat: add FabPosition and ChatAssistantMode enums
Totremont Jun 30, 2026
d58c8ac
feat: add FAB drag and corner-positioning frontend
Totremont Jun 30, 2026
ad1701c
feat: add chat window resize and sizing frontend
Totremont Jun 30, 2026
16004b6
fix: tighten spacing of markdown messages
Totremont Jun 30, 2026
101ddf9
feat: add FAB, window, and mode configuration to ChatAssistant
Totremont Jun 30, 2026
fd96c16
feat(demo): rewrite core and content demos
Totremont Jun 30, 2026
c21696f
feat(demo): add FAB configuration and in-a-box demos
Totremont Jun 30, 2026
a5d1a98
feat(demo): add modes and responsive demo
Totremont Jun 30, 2026
65c3d73
feat(demo): register the demo views in the tabbed view
Totremont Jun 30, 2026
d37651c
test: parameterize ChatAssistant type in serialization test
Totremont Jun 30, 2026
f9a84a6
refactor: drop redundant serial annotations
Totremont Jun 30, 2026
da49b2c
test: tidy integration test imports and assertions
Totremont Jun 30, 2026
fcf8b54
chore: ignore generated web-component.html
Totremont Jun 30, 2026
39def6a
docs(readme): document FAB, window, and mode features
Totremont Jun 30, 2026
b65ec10
refactor: add classname to markdown selector
Totremont Jul 1, 2026
d856400
fix: portal FAB to body so it escapes ancestor containing blocks
Totremont Jul 23, 2026
cfebfdd
Merge branch 'master' into chat-assistant-5.1.0
scardanzan Aug 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ drivers
/types.d.ts*
/frontend/generated
/frontend/index.html
/frontend/web-component.html
/src/main/frontend/web-component.html
/src/main/frontend/generated
/src/main/frontend/index.html
vite.generated.ts
Expand Down
104 changes: 83 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ Vaadin Add-on that displays a chat assistant floating window using [Material UI'

## Features

* Messages can be sent by the user or programmatically.
* Listen for new messages written by the user.
* Toggle the chat window on/off.
* Send messages from the user or programmatically, and listen for messages written by the user.
* Toggle the chat window open/closed, or open it as a full-screen dialog on mobile.
* Markdown rendering, lazy loading via a `DataProvider`, and streaming ("generative") answers.
* Customizable floating action button (FAB): icon, size, color (`FabVariant` theme variants),
corner position and margin, draggable or fixed, and viewport- or container-anchored placement.
* Resizable chat window with eight drag handles, optional resize direction indicators, and
configurable initial size with min/max bounds.
* Responsive desktop/mobile modes with optional breakpoint-based auto-switching, plus listeners for
mode changes and for the chat window crossing a size threshold.
* A fluent `ChatAssistant.builder()` to configure everything declaratively.

## Supported versions

Expand Down Expand Up @@ -96,24 +103,79 @@ Chat Assistant Add-on is written by Flowing Code S.A.

## Getting started

Simple example showing the basic options:

ChatAssistant chatAssistant = new ChatAssistant();
TextArea message = new TextArea();
message.setLabel("Enter a message from the assistant");
message.setSizeFull();

Button chat = new Button("Chat");
chat.addClickListener(ev->{
Message m = new Message(message.getValue(),false,false,0,false,new Sender("Assistant","1","https://ui-avatars.com/api/?name=Bot"));
chatAssistant.sendMessage(m);
message.clear();
});
chatAssistant.sendMessage(new Message("Hello, I am here to assist you",false,false,0,false,new Sender("Assistant","1","https://ui-avatars.com/api/?name=Bot")));
chatAssistant.toggle();
chatAssistant.addChatSentListener(ev->{
Notification.show(ev.getMessage());
});
`ChatAssistant<T extends Message>` renders a floating action button (FAB) that opens a chat window.
Add it to any layout and send messages to it; it shows a FAB in the bottom-right corner by default.

```java
ChatAssistant<Message> chatAssistant = new ChatAssistant<>();
add(chatAssistant);

// Send a message programmatically (e.g. from the assistant).
chatAssistant.sendMessage(Message.builder()
.name("Assistant")
.content("Hello, I am here to assist you")
.messageTime(LocalDateTime.now())
.build());

// React to messages typed by the user.
chatAssistant.setSubmitListener(ev ->
chatAssistant.sendMessage(Message.builder()
.name("User")
.content(ev.getValue())
.messageTime(LocalDateTime.now())
.build()));

// Open or close the window programmatically.
chatAssistant.setOpened(true);
```

### Configuring with the builder

Use `ChatAssistant.builder()` to configure the FAB and window declaratively:

```java
ChatAssistant<Message> chatAssistant = ChatAssistant.<Message>builder()
.fabIcon(new SvgIcon("icons/my-icon.svg")) // custom FAB icon (defaults to a chatbot icon)
.defaultFabPosition(FabPosition.BOTTOM_LEFT)
.fabMovable(true) // allow dragging the FAB
.resizable(true) // allow resizing the window
.markdownEnabled(true) // render message content as Markdown
.build();
```

Everything in the builder also has a setter, so the FAB and window can be reconfigured at runtime.

### Styling the FAB

```java
chatAssistant.setFabPosition(FabPosition.TOP_RIGHT); // move it (and set the reset corner)
chatAssistant.addFabThemeVariants(FabVariant.LARGE); // grow the FAB (FabVariant.SMALL/LARGE)
chatAssistant.addFabThemeVariants(FabVariant.LUMO_CONTRAST); // recolor it (color variants)
chatAssistant.setResizeIndicatorsVisible(true); // show resize-direction hints
```

### Sizing the window

```java
chatAssistant.setWindowWidth("400px");
chatAssistant.setWindowHeight("500px");
chatAssistant.setWindowMinWidth(300); // bounds honored on open and while resizing
chatAssistant.setWindowMaxWidth(700);
```

### Responsive / mobile mode

In `MOBILE` mode the chat opens as a full-screen dialog. Set a breakpoint to switch automatically
between desktop (anchored popover) and mobile as the viewport crosses it:

```java
ChatAssistant<Message> chatAssistant = ChatAssistant.<Message>builder()
.mobileBreakpoint(768) // auto-switch to mobile below 768px (auto-switching is opt-in)
.build();

chatAssistant.addModeChangedListener(ev -> Notification.show("Now in " + ev.getMode() + " mode"));
chatAssistant.setMode(ChatAssistantMode.MOBILE); // or switch manually
```

## Special configuration when using Spring

Expand Down
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.vaadin.addons.flowingcode</groupId>
<artifactId>chat-assistant-addon</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.1.0-SNAPSHOT</version>
<name>Chat Assistant Add-on</name>
<description>Chat Assistant Add-on for Vaadin Flow</description>
<url>https://www.flowingcode.com/en/open-source/</url>
Expand All @@ -20,7 +20,6 @@
<webdriver.chrome.driver>${drivers.dir}/chromedriver</webdriver.chrome.driver>
<jetty.version>11.0.26</jetty.version>
<flowingcode.commons.demo.version>5.2.0</flowingcode.commons.demo.version>
<markdown-editor.version>2.0.3</markdown-editor.version>
<lombok.version>1.18.46</lombok.version>
<hamcrest.version>1.3</hamcrest.version>
<servlet-api.version>3.1.0</servlet-api.version>
Expand Down Expand Up @@ -125,11 +124,6 @@
<artifactId>vaadin-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.flowingcode.vaadin.addons</groupId>
<artifactId>markdown-editor-addon</artifactId>
<version>${markdown-editor.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Loading
Loading