diff --git a/README.md b/README.md index 1cd9225..3413b8f 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,9 @@ Ensure your project is using Go Modules (it will have a `go.mod` file in its roo ## Usage +> [!TIP] +> refer to the [Examples](#examples) section. + Import the Dropdown module into your project: ```go @@ -99,6 +102,8 @@ func HandleHome(w http.ResponseWriter, r *http.Request) { ### Dropdown Component Structure - Markup +In your `templ` file, defines the structure for the dropdown component. + > [!IMPORTANT] > It is crucial to ensure that the value passed to `gropdown.Root` **matches** the one used when adding the `gropdownConfig` to the `configMap` as per step above. This ensures that multiple dropdowns on the same page function independently. @@ -145,37 +150,43 @@ func HandleHome(w http.ResponseWriter, r *http.Request) { - `GropdownCSS`: it supplies the required CSS, encapsulating the visual design and layout specifics of the component. - `GropdownJS`: it provides the JavaScript logic essential for dynamic behaviors such as displaying, keyboard navigation and interaction with the component. -To facilitate integration with Go's `template/html` standard library, `gropdown` includes a dedicated HTMLGenerator type to seamlessly integrate the component into web applications built with Go's `html/template standard` library. +To facilitate integration with Go's `template/html` standard library, `gropdown` includes a dedicated `HTMLGenerator` type to seamlessly integrate the component into web applications built with Go's `html/template standard` library. There are methods acting as wrappers to the templ's `templ.ToGoHTML`, generate the necessary HTML to be embedded them into server-rendered pages: - `GropdownCSSToGoHTML`: render the `GropdownCSS` component into a `template.HTML` value. - `GropdownJSToGoHTML`: render the `GropdownJS` component into a `template.HTML` value. -> Note: refer to the [Examples](#examples) section to see how to use `gropdown` with templ and `html/template`. - ## API Reference -gropdown.Root +