A customer support chat screen built with pure CSS and vanilla JavaScript: an agent header with online status, bot and agent messages, an order card inside the conversation, quick reply chips, a star rating request and a message composer with an attachment sheet. It is an HTML mobile template for mobile sites and PWAs and can be packaged with Capacitor. Use it as the live chat UI, help desk chat or chatbot interface of a shop or service app.
How it works
The root .sc-app is a full-height column (max 430px, centred on wide screens): the .sc-top agent header, the scrollable .sc-log (role="log", scrolled to the newest message on load) and the .sc-foot with quick replies and the composer.
Messages are .sc-msg--in (bot or agent, with avatar and .sc-sender name) and .sc-msg--out (the customer, in purple). The .sc-order card shows the product, an "Out for delivery" .sc-pill and a four-step .sc-track progress bar.
Each .sc-chip sends its label as a message. The composer form [data-sc-composer] keeps the send button disabled until text is typed, then appends the message with the current time, shows the [data-sc-typing] indicator and posts an answer from REPLIES (or FALLBACK).
The rating request [data-sc-rate] is a group of five radio buttons drawn as stars; choosing one lights up all stars up to it, and Send without a choice shows an error. The attachment button opens dialog.sc-sheet, a bottom sheet with Photo, Receipt and Document options that add a file message.
Customization
--sc-accent,--sc-accent-darkand--sc-accent-softon.sc-app: the purple of outgoing bubbles, buttons, chips and the order progress.--sc-in: the background of incoming bubbles;--sc-star: the colour of lit stars.REPLIESandFALLBACKinscript.js: the demo answers; replacereply()with a call to your chat backend or WebSocket..sc-chipbuttons inindex.html: change the quick reply labels and add matching keys toREPLIES.data-sc-fileanddata-sc-shareon the.sc-sheet-itembuttons: the file name and label used for the attachment message.- The rating submit handler: add
fetch()where the comment says, to store the score.
Use cases
- Online stores: answer order and delivery questions next to the order details.
- Banking and insurance apps: chatbot to human handover.
- Telecom and utility apps: quick replies for common requests such as plan changes.
- SaaS help centers: collect a satisfaction rating at the end of each chat.
Accessibility
The log has role="log" with aria-live="polite", so new messages are announced. Icon buttons carry aria-labels, the stars are real radio buttons in a fieldset with a hidden legend, so arrow keys change the rating, and the error message is linked with aria-describedby. The sheet is a modal <dialog>: Escape and a tap on the backdrop close it and focus returns to the attachment button. The typing dots and the sheet animation stop with prefers-reduced-motion.
Usage notes
The agent portrait and product photo come from Unsplash; replace them with your own images.