Giter Club home page Giter Club logo

Comments (11)

thekevingibbons avatar thekevingibbons commented on May 17, 2024 14

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;
}

from pretty-checkbox.

lokesh-coder avatar lokesh-coder commented on May 17, 2024 8

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

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

from pretty-checkbox.

JamesTheHacker avatar JamesTheHacker commented on May 17, 2024 7

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;
  }

from pretty-checkbox.

Leapje avatar Leapje commented on May 17, 2024 3

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!

from pretty-checkbox.

saiqulhaq avatar saiqulhaq commented on May 17, 2024 2

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

from pretty-checkbox.

martinduparc avatar martinduparc commented on May 17, 2024 1

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

from pretty-checkbox.

lokesh-coder avatar lokesh-coder commented on May 17, 2024

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!

from pretty-checkbox.

SeminAl avatar SeminAl commented on May 17, 2024

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

from pretty-checkbox.

Furgas avatar Furgas commented on May 17, 2024

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

from pretty-checkbox.

applyACS avatar applyACS commented on May 17, 2024

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

from pretty-checkbox.

jmcbsimmonds avatar jmcbsimmonds commented on May 17, 2024

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;
}

from pretty-checkbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.