CHROMATIC-SYSTEM v1.03_SPLIT_BUTTON_DISPLAY_ENGINE

INFORMATION & CODE

Split Button Display

What the Code Does

This code creates a custom "split button" user interface component, which combines a standard clickable button on the left with a dropdown menu arrow on the right. Visually styled using CSS to blend seamlessly together—complete with rounded outer corners and matching blue backgrounds—the component merges HTML structure, CSS styling, and JavaScript interactivity. The HTML defines a wrapper containing a main <button> element and a native HTML <select> dropdown element nested inside a label, while the CSS removes default browser appearances for the select dropdown, adds a custom downward- pointing triangle icon (), and sets up hover and active state colors.

How the Code Works

The mechanism works by placing a styled <select> element directly adjacent to a <button> element inside a relative wrapper, utilizing margins and positioning to make them look like a single, unified control. The JavaScript file enhances this by adding an event listener to the select dropdown, which listens for user interactions and is intended to dynamically update the text of the main button based on the user's selection from the dropdown list (though the provided JS references a .choices class that is not present in the HTML).

How to Use the Code

To use this code in your own web project, simply copy the HTML snippet into the body of your webpage, ensure the CSS is placed in a linked styles.css file (or within a <style> tag in the ), and link the JavaScript via a scripts.js file just before the closing <body> tag. You can easily customize the button text, dropdown choices, and color scheme by modifying the HTML option values and adjusting the background color properties (#0077ff) in the CSS stylesheet to match your website's design.

HTML

CSS

JAVASCRIPT