Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide way to specify size to border #31299

Closed
subrayamallya opened this issue Jul 14, 2020 · 6 comments · Fixed by #31484
Closed

Provide way to specify size to border #31299

subrayamallya opened this issue Jul 14, 2020 · 6 comments · Fixed by #31484

Comments

@subrayamallya
Copy link

Currently we have border, border-primary, border-success etc all of them seem to only have a 1 pixel thick border with no ability to make the border thicker/wider. The border with 1 pixel gets lost when you have padding, margins or shadow.

Would it be possible to add a border-size attribute?

We can either have

  • pixel count specified like border-1, border-2, border-3 (a finite list of choices) OR
  • named sizes like we have in shadow such as border-none border border-sm, border-lg
@JagadishSivakumar
Copy link

Hi @subrayamallya
Having a border-size attribute will be awesome and very handy.
But the actual problem with such design attributes is border-1, border-2 .. will be very distinct and the developer will not be able to use intermediate width for the border element.

border-width:3px 

@subrayamallya
Copy link
Author

Hi @subrayamallya
Having a border-size attribute will be awesome and very handy.
But the actual problem with such design attributes is border-1, border-2 .. will be very distinct and the developer will not be able to use intermediate width for the border element.

border-width:3px 

Fair enough. I was relying on the smart guys in Bootstrap team to make a better call on this than my rudimentary suggestion :-)

@mdo mdo added the css label Jul 31, 2020
@mdo
Copy link
Member

mdo commented Jul 31, 2020

Having a Sass map that provides a few utilities to scale the border quickly could be nice. Suggestions on values to support?

@sio-iago
Copy link

sio-iago commented Aug 4, 2020

Any chance I can contribute to this? I have an idea.

We can have a mixin on utilities, so it's available to all developers:

@mixin make-border-width($width: 1) {
    border-width: $width;
}

With the mixin we can define some default border classes:

border-1
make-border-width(1px)

border-2
make-border-width(2px)

border-3
make-border-width(4px)

border-4
make-border-width(6px)

border-5
make-border-width(8px)

@subrayamallya
Copy link
Author

subrayamallya commented Aug 14, 2020

Can we do something similar to what you have done for Sass map $display-font-sizes and have the Sass map
$border-width-sizes

$border-width-sizes: (
1: 1rem,
2: 1.5rem,
3: 2rem,
4: 2.5rem,
5: 3rem,
6: 3.5rem
);

You can even have the size in reverse order if you want to keep the order consistent with $display-font-sizes

@MauricioHernanCabrera
Copy link
Contributor

I can do a border-width utility
For example

.border-width-1 {
   border-width: 1px;
}

.border-width-2 {
   border-width: 2px;
}

.border-width-3 {
   border-width: 3px;
}

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants