CHROMATIC-SYSTEM v1.03_DELIVERY_METHOD_PICKER_DISPLAY_ENGINE

INFORMATION & CODE

The code creates an interactive delivery method selector that allows a user to choose one of three shipping options, submit their selection, and then reset the interface for another selection. It combines HTML for the page structure, CSS for the appearance and visual feedback, and JavaScript for the interactive behaviour.

The HTML defines the layout of the delivery picker. A `.payment-wrapper` contains three delivery options, each made up of a radio button, a custom checkmark, a delivery name, price, and estimated delivery time. All radio buttons share the same name (rad), ensuring that only one option can be selected at a time. A Submit button displays the chosen delivery method, while a hidden Go To Delivery Method button allows the interface to be reopened after it has been reset.

The CSS is responsible for the styling of the picker. It creates card-like containers for each delivery method, customises the radio buttons with circular checkmarks, styles the buttons, and adds colours, borders, shadows, and hover effects to improve the appearance. Additional classes such as .active and .show are used to hide or reveal elements when controlled by JavaScript. The styling also changes the visual state of delivery options, using red to indicate unselected items and green to highlight the currently selected one.

The JavaScript provides the functionality. It first stores references to the key HTML elements, including the delivery options, buttons, wrapper, and text output. When the Submit button is clicked, the script loops through the radio buttons to find the selected option, retrieves its value, and displays it in the <h4> element. After five seconds, the resetWrap() function is automatically called to reset the interface.

The borderChange() function runs whenever a delivery option is selected. It first resets every delivery card to a red, unselected appearance, then highlights the chosen option by changing its background, border, and shadow to green while removing the shadow around its checkmark. This gives the user immediate visual confirmation of their selection.

The resetWrap() function restores the picker to its default state. It removes all radio button selections, returns every delivery option to its red styling, clears the displayed delivery text, hides the main delivery picker by adding the .active class, and displays the Go To Delivery Method button by adding the .show class. Clicking this button removes the hiding classes, making the delivery picker visible again so the user can make a new selection.

To use the code, simply load the HTML page in a web browser. Select one of the delivery methods, click Submit, and the selected delivery option will be displayed beneath the button. Five seconds later, the picker automatically resets and is hidden. Clicking Go To Delivery Method reopens the picker, allowing another delivery method to be selected. This makes the component suitable for demonstrating custom radio button controls, selection highlighting, and interface reset behaviour in a checkout or ordering system.

HTML

CSS

JAVASCRIPT