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

Support for multiple lines in label? #25

Open
SeminAl opened this issue Oct 30, 2017 · 11 comments
Open

Support for multiple lines in label? #25

SeminAl opened this issue Oct 30, 2017 · 11 comments

Comments

@SeminAl
Copy link

SeminAl commented Oct 30, 2017

I have spent several hours trying to make pretty checkbox with multiple lines of text in label, but no success... This was not planned from the beginning or am I wrong?

@lokesh-coder
Copy link
Owner

Hi @SeminAl ,

As you mentioned, the label text is expected to be in one line, and that's how it was built. Else the design will fail.

But I can imagine use cases of multi line label. May be in the next release I will come up with a solution for this.

Thanks!

@lokesh-coder
Copy link
Owner

Hi @SeminAl , I just made a fiddle for multi line label. Let me know if that helps. Thanks!

https://jsfiddle.net/lokesh_coder/my15u1gm/

@SeminAl
Copy link
Author

SeminAl commented Nov 1, 2017

That's exactly what I was looking for :) Thank you!

@martinduparc
Copy link

@lokesh-coder Want to integrate your fiddle into the repo?

@Furgas
Copy link

Furgas commented Mar 25, 2018

Great. I used top: calc(50% - ((1em + 2px)/2)) instead of top: 0, to center it horizontally.

@saiqulhaq
Copy link

why this multi line label hasn't integrated into repo yet?

@JamesTheHacker
Copy link

JamesTheHacker commented Sep 16, 2018

If you're using icons you'll need to do:

  .pretty .state label:after, 
  .pretty .state label:before,
  .pretty.p-icon .state .icon {
    top: 0;
  }

@thekevingibbons
Copy link

To size the labels relative to the parent div, change the width in .pretty to 100%. Allows the labels to be =pretty= responsive.
Full CSS including the line that makes icons work. I import it as pretty-multiline.css after the pretty-checkboxes package.

/* Overwriting some Pretty-Checkbox styles to allow for word wrapping */
.pretty {
    white-space: normal;
    width: 100%;
}

.pretty .state label 
{
    text-indent: 0;
    padding-left: 2rem;
}

.pretty .state label:after,
.pretty .state label:before,
.pretty.p-icon .state .icon 
{
    top: 0;
}

@applyACS
Copy link

This is really a big issue and should be fixed as soon as possible.

@Leapje
Copy link

Leapje commented Jul 18, 2019

Great fix, I made a little change:

.pretty .state label:after, .pretty .state label:before, .pretty.p-icon .state .icon, .pretty.p-svg .state .svg { top: 0; }

Then the svg image is also in the right place!

@jmcbsimmonds
Copy link

I was able to make pretty check box handle wrapping of long text for labels and allow for click-able links within them with the following:

.pretty .state label {
white-space: normal;
text-indent: unset;
padding-left: 5vw; /* Change to your preferred dimensions */
}

/* This will make the use of an svg align correctly, you may need to add other formats if you use them. */
.pretty.p-svg .state .svg,
.pretty .state label:after,
.pretty .state label:before {
top: 0;
}

/* Make pretty checkbox handle links in labels, thanks goes to pmonte, for a pointer in the right direction */
.pretty a {
z-index: 3;
position: relative;
}

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

No branches or pull requests

10 participants