56 | );
57 | }
58 |
--------------------------------------------------------------------------------
/src/pages/index.tsx:
--------------------------------------------------------------------------------
1 | import clsx from "clsx";
2 | import Link from "@docusaurus/Link";
3 | import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
4 | import Layout from "@theme/Layout";
5 | import HomepageFeatures from "@site/src/components/HomepageFeatures";
6 | import Heading from "@theme/Heading";
7 |
8 | import styles from "./index.module.css";
9 |
10 | function HomepageHeader() {
11 | const { siteConfig } = useDocusaurusContext();
12 | return (
13 |
14 |
15 |
19 | {siteConfig.title}
20 |
21 |
22 | Add Stylish Borders{" "}
23 | with Ease
24 |
25 |
26 |
33 | Quick Start
34 |
35 |
36 |
37 |
38 | );
39 | }
40 |
41 | export default function Home(): JSX.Element {
42 | return (
43 |
44 |
45 |
46 |
47 |
48 | );
49 | }
50 |
--------------------------------------------------------------------------------
/docs/border-styles/border-styles/add-generic-border.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "addGenericBorder"
3 | ---
4 |
5 | ## Overview
6 |
7 | The `addGenericBorder` function applies a pre-styled border to an HTML element. You can specify the border style (such as `"solid"`, `"double"`, or `"dotted"`) and customize optional properties like border color and width.
8 |
9 | ### Parameters
10 |
11 | - `element`: The target HTML element to which the border will be added.
12 | - `borderStyle`: The style of the border (e.g., "solid", "double", "dotted").
13 | - `borderOptions` (**_optional_**): An object with optional design properties, including:
14 | - `borderColor`: The color of the border.
15 | - `borderWidth`: The thickness of the border (default values apply if not specified).
16 |
17 | ### Returns
18 |
19 | The updated `HTMLElement` with the applied border.
20 |
21 | ## Demo
22 |
23 | ### Example 1
24 |
25 | ```js
26 | import { addGenericBorder } from "bordex";
27 |
28 | const element = document.getElementById("element");
29 |
30 | // Adds a generic border to an element.
31 | addGenericBorder(element, "groove");
32 | ```
33 |
34 | 
35 |
36 | ### Example 2
37 |
38 | ```js
39 | import { addGenericBorder } from "bordex";
40 |
41 | // Assuming you have an HTML element to apply the border to
42 | const element = document.getElementById('element');
43 |
44 | // Adds a generic border to an element with a specified options.
45 | addGenericBorder(element, 'groove', { borderColor: '#BFFF00', borderWidth:'15px' }),
46 | ```
47 |
48 | 
49 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
Bordex
5 |
6 | This is repository contains the documentation for the JavaScript library [Bordex](https://github.com/Bear-Frost/bordex), which helps create pre-styled borders for HTML elements.
7 |
7 |
11 | To ensure proper functionality, the HTMLDivElement wrapper around the
12 | original element must have a background applied. You can create a class
13 | for this purpose as follows:
14 |
15 |
16 | set the styling of the class first using css.
17 |
18 | {`/* the provided class name of the border container element,
19 | the style in this class is going to get applied to the border-container-element */
20 | .boder-container-element {
21 | background-color: black;
22 | }
23 | `}
24 |
25 | we can then add a generated border to our element.
26 |
27 | {`const element = document.getElementById('element');
28 | /* we passed in a third argument to the function, and that is the class
29 | that is going to get applied to the border container element,
30 | that we and target in css. */
31 | addGradientBorder(element,{},'border-container-element')
32 | `}
33 |
34 | or if you want you can just add the style for the border container
35 | element in javascript like this.
36 |
37 | {`const element = document.getElementById('element');
38 | const borderContainer = addGradientBorder(element,{},'border-container-element');
39 |
40 | borderContainer.style.backgroundColor = "black";
41 | `}
42 |
43 |
44 | If you have specific styling to apply to the original element, simply
45 | add those styles directly to the border container element instead.
46 |
47 |
48 | );
49 | }
50 |
--------------------------------------------------------------------------------
/src/components/HomepageFeatures/index.tsx:
--------------------------------------------------------------------------------
1 | import clsx from "clsx";
2 | import Heading from "@theme/Heading";
3 | import styles from "./styles.module.css";
4 |
5 | type FeatureItem = {
6 | title: string;
7 | description: JSX.Element;
8 | };
9 |
10 | const FeatureList: FeatureItem[] = [
11 | {
12 | title: "Most of the time it Works",
13 | description: (
14 | <>
15 | Generate stylish borders with a single function call! Most of the time
16 | they look great, but sometimes they play hard to get. Embrace the
17 | unpredictability!
18 | >
19 | ),
20 | },
21 | {
22 | title: "Customizable with Limits",
23 | description: (
24 | <>
25 | Adjust your borders with a variety of settings, just be careful what you
26 | pass in! The wrong choice might lead to unexpected surprises.
27 | >
28 | ),
29 | },
30 | {
31 | title: "Lots of Bugs",
32 | description: (
33 | <>
34 | This library has its fair share of lovable bugs! While it’s working
35 | sometimes, expect some quirks as improvements are made. Your patience is
36 | appreciated!
37 | >
38 | ),
39 | },
40 | ];
41 |
42 | function Feature({ title, description }: FeatureItem) {
43 | return (
44 |
71 |
72 | );
73 | }
74 |
--------------------------------------------------------------------------------
/docs/api/type-definition/type/border-types.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Border Types"
3 | ---
4 |
5 | ## `CommonBorderStyles` Type
6 |
7 | The `CommonBorderStyles` type defines the various styles that can be applied to borders. It includes all of the valid CSS `border-style` value.
8 |
9 | ```ts
10 | type CommonBorderStyles =
11 | | "solid"
12 | | "double"
13 | | "dotted"
14 | | "dashed"
15 | | "outset"
16 | | "inset"
17 | | "groove"
18 | | "ridge";
19 | ```
20 |
21 | ## `BorderColorOptional` Type
22 |
23 | An optional value of the [IBorderColor](../interface/border-interfaces#ibordercolor-interface) interface.
24 |
25 | ```ts
26 | type BorderColorOptional = Partial;
27 | ```
28 |
29 | ## `BorderWidthOptional` Type
30 |
31 | An optional value of the [IBorderWidth](../interface/border-interfaces#iborderwidth-interface) interface.
32 |
33 | ```ts
34 | type BorderWidthOptional = Partial;
35 | ```
36 |
37 | ## `BorderStyleOptional` Type
38 |
39 | An optional value of the [IBorderColor](../interface/border-interfaces#ibordercolor-interface)
40 |
41 | ```ts
42 | type BorderStyleOptional = Partial;
43 | ```
44 |
45 | ## `BorderOptions` Type
46 |
47 | An intersection value of [IBorderWidth](../interface/border-interfaces#iborderwidth-interface), [IBorderColor](../interface/border-interfaces#ibordercolor-interface), [IBorderStyle](../interface/border-interfaces#iborderstyle-interface)
48 |
49 | ```ts
50 | type BorderOptions = IBorderWidth & IBorderColor & IBorderStyle;
51 | ```
52 |
53 | ## `BorderOptionsOptional` Type
54 |
55 | An Optional value of the [BorderOptions](./border-types#borderoptions-type)
56 |
57 | ```ts
58 | type BorderOptions = Partial;
59 | ```
60 |
61 | ## `FullBorderOptions` Type
62 | A type alias for [BorderOptionsOptional](./border-types#borderoptionsoptional-type)
63 | ```ts
64 | type FullBorderOptions = BorderOptionsOptional;
65 | ```
66 |
67 | ## `ThinBorderSides` Type
68 |
69 | Specifies the sides to which a thin border can be applied.
70 |
71 | ```ts
72 | type ThinBorderSides =
73 | | "top"
74 | | "right"
75 | | "bottom"
76 | | "left"
77 | | "horizontal"
78 | | "vertical";
79 | ```
80 |
--------------------------------------------------------------------------------
/docs/border-styles/border-styles/add-thin-border.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "addThinBorder"
3 | ---
4 |
5 | ## Overview
6 |
7 | The `addThinBorder` function applies a thin, customizable border to an HTML element on a specified side or orientation. It allows you to define the color, side placement, and outset spacing, along with an optional class name for further styling.
8 |
9 | ### Parameters
10 |
11 | - `element`: The target HTML element to which the thin border will be applied.
12 | - `borderOptions` (**_optional_**): An object for configuring the thin border, including:
13 | - `color`: The color of the thin border (defaults to a secondary theme color).
14 | - `side`: The side(s) where the thin border should be placed (e.g., `'top'`, `'bottom'`, `'left'`, `'right'`, `'horizontal'`, or `'vertical'`).
15 | - `outset`: The amount of spacing between the thin border and the element (applies horizontally or vertically depending on the selected side).
16 | - `className` (**_optional_**): Custom class name for applying additional CSS styles to the border container.
17 |
18 | ### Returns
19 |
20 | An `HTMLDivElement` that wraps the original element with the thin border applied.
21 |
22 | ## Demo
23 |
24 | :::warning Function Notice: Limited Background Support
25 | This function may not work properly if the original element or the border container element has a background applied.
26 |
27 | For best results, avoid setting a background on these elements until improvements are made.
28 | :::
29 |
30 | ### Example 1
31 |
32 | ```js
33 | import { addThinBorder } from "bordex";
34 |
35 | // Assuming you have an HTML element to apply the border to
36 | const element = document.getElementById("element");
37 |
38 | // Adds a thin border to an element.
39 | addThinBorder(element, {}, "element");
40 | ```
41 |
42 | 
43 |
44 | ### Example 2
45 |
46 | ```js
47 | import { addThinBorder } from "bordex";
48 |
49 | // Assuming you have an HTML element to apply the border to
50 | const element = document.getElementById("element");
51 |
52 | // Adds a thin border to an element with a specified options.
53 | addThinBorder(element, { side: "horizontal" }, "element");
54 | ```
55 |
56 | 
57 |
--------------------------------------------------------------------------------
/docs/api/type-definition/interface/border-styles-interfaces.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Border Style Interfaces
3 | ---
4 |
5 | import Table from "../../../../src/components/api-tables";
6 |
7 | ## `IBlurBorderOptions` Interface
8 |
9 | The `IBlurBorderOptions` interface defines the properties for configuring a blurred border effect. It includes attributes for specifying the border color and border width, just make sure that valid CSS values are used.
10 |
11 |
27 |
28 | ## `IDisjointedBorderOptions` Interface
29 |
30 | The `IDisjointedBorderOptions` interface defines the properties for creating a disjointed border effect. It includes options for specifying the angle and color of the border, just make sure that valid CSS values are used.
31 |
32 |
48 |
49 | ## `IGradientBorderOptions` Interface
50 |
51 | **Extends**: [BorderWidthOptional](../type/border-types/#borderwidthoptional-type)
52 |
53 | The `IGradientBorderOptions` interface defines the properties for creating a gradient border effect. It includes options for specifying the angle and an array of colors that will form the gradient.
54 |
55 |
71 |
72 | ## `IInsetBorderOptions` Interface
73 |
74 | **Extends**: [BorderWidthOptional](../type/border-types/#borderwidthoptional-type)
75 |
76 | The `IInsetBorderOptions` interface defines properties for configuring inset borders. It includes options for specifying the border offset and style.
77 |
78 |
97 |
98 | ## `IStripeBorderOptions` Interface
99 |
100 | **Extends**: [BorderWidthOptional](../type/border-types/#borderwidthoptional-type)
101 |
102 | The `IStripeBorderOptions` interface defines properties for configuring striped borders. It includes options for specifying the width of each stripe and the colors used in the border.
103 |
104 |
120 |
121 | ## `IThinBorder` Interface
122 |
123 | The `IThinBorder` interface defines properties for configuring a thin border. It includes options for specifying the border color, the side on which the border is applied, and its outset.
124 |
125 |
151 |
--------------------------------------------------------------------------------
/docs/api/type-definition/interface/border-interfaces.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Border Interfaces"
3 | sidebar_position: 1
4 | ---
5 |
6 | import Table from "../../../../src/components/api-tables";
7 |
8 | ## `IBorderColor` Interface
9 |
10 | The `IBorderColor` interface defines color properties for each side of a border in a CSS-compatible format. Each property accepts a string representing a valid CSS color value, such as a named color (`"red"`), a hexadecimal color (`"#ff0000"`), or an `rgba` color value (`"rgba(255, 0, 0, 1)"`).
11 |
12 | This interface provides flexibility in setting individual colors for the top, right, bottom, and left borders of an element. You can also set a singl
13 |
14 |
48 |
49 | ## `IBorderWidth` Interface
50 |
51 | The `IBorderWidth` interface defines properties to set the width of each side of a border using valid CSS width values. Each property accepts a string representing any valid CSS width unit, such as pixels (`"1px"`), em units (`"2em"`), or percentages (`"50%"`).
52 |
53 | This interface enables you to define individual border widths for each side top, right, bottom, and left. Additionally, you can use the `borderWidth` property to apply the same width to all four borders.
54 |
55 |
89 |
90 | ## `IBorderStyle` Interface
91 |
92 | The `IBorderStyle` interface defines properties to set the style of each side of a border using predefined border styles. Each property accepts a value from the [CommonBorderStyles](../type/border-types#commonborderstyles-type) type, which includes options like `'solid'`, `'dashed'`, and `'dotted'`.
93 |
94 | This interface allows you to specify individual border styles for each side top, right, bottom, and left. Additionally, you can use the `borderStyle` property to apply the same style to all four borders.
95 |
96 |
145 |
146 | ## `IShortHandBorderOptions` Interface
147 |
148 | The `IBorderOptions` interface defines the attributes for configuring borders in a consistent manner. It includes properties for border width, color, and style, which can be applied to all sides of an element.
149 |
150 |
175 |
176 | ## `IshorthandBorder` Interface
177 |
178 | The `IBorderOptions` interface defines the attributes for configuring borders in a consistent manner. It includes properties for all of the border options.
179 |
180 |
204 |
--------------------------------------------------------------------------------
/docs/api/api.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Bordex API
3 |
4 | sidebar_position: 1
5 | ---
6 |
7 | import Table from "../../src/components/api-tables";
8 |
9 | # Bordex Border Styles API
10 |
11 | ## `addBlurBorder()`
12 |
13 | **Returns:** `HTMLElement` - return the HTMLElement passed as the first argument
14 |
15 | **Description**:
16 |
17 | Applies a blur border style to the specified element and returns that element.
18 |
19 |
37 |
38 | ## `addCornerBorder()`
39 |
40 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with a blur border applied.
41 |
42 | **Description**:
43 |
44 | Applies a corner border style to the specified element and returns a new div element that wraps around the original element or the element provided.
45 |
46 |
68 |
69 | ## `addDisjointedBorder()`
70 |
71 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with a blur border applied.
72 |
73 | **Description**:
74 |
75 | Applies a disjointed border style to the specified element and returns a new div element that wraps around the original element or the element provided.
76 |
77 |
99 |
100 | ## `addFancyBorder()`
101 |
102 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with a blur border applied.
103 |
104 | **Description**:
105 |
106 | Applies a faancy border style to the specified element and returns a new div element that wraps around the original element or the element provided.
107 |
108 |
130 |
131 | ## `addGenericBorder()`
132 |
133 | **Returns:** `HTMLElement` - return the HTMLElement passed as the first argument
134 |
135 | **Description**:
136 |
137 | Applies a generic border style to the specified element and returns that element.
138 |
139 |
162 |
163 | ## `addGradientBorder()`
164 |
165 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with a gradient border applied.
166 |
167 | **Description**:
168 |
169 | Applies a gradient border style to the specified element and returns a new div element that wraps around the original element or the element provided.
170 |
171 |
195 |
196 | ## `addInsetBorder()`
197 |
198 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with an inset border applied.
199 |
200 | **Description**:
201 |
202 | Applies an inset border style to the specified element and returns a new div element that wraps around the original element or the element provided.
203 |
204 |
223 |
224 | ## `addOverlapBorder()`
225 |
226 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with an overlap border applied.
227 |
228 | **Description**:
229 |
230 | Applies an overlap border style to the specified element and returns a new div element that wraps around the original element or the element provided.
231 |
232 |
252 |
253 | ## `addStripeBorder()`
254 |
255 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with a stripe border applied.
256 |
257 | **Description**:
258 |
259 | Applies a stripe border style to the specified element and returns a new div element that wraps around the original element or the element provided.
260 |
261 |
282 |
283 | ## `addThinBorder()`
284 |
285 | **Returns:** `HTMLDivElement` - A `div` element that wraps the target element with a thin border applied.
286 |
287 | **Description**:
288 |
289 | Applies a thin border style to the specified element and returns a new div element that wraps around the original element or the element provided.
290 |
291 |
311 | {/* A `div` element that wraps the target element with a blur border applied. */}
312 |
--------------------------------------------------------------------------------