But we already have a truncation bead. The only reason it doesn’t work in Label is because spans don’t have widths.
Label is not something which should flow beyond its bounds — which is what span is useful for. I still don’t see why you think span makes more sense. FWIW, div *is* used as a container for text in various frameworks. My $0.02, Harbs > On Mar 15, 2018, at 9:42 PM, Alex Harui <[email protected]> wrote: > > AIUI, "inline" is the default display style for Span. "block" is the > default for Div. HTML flows inline by default for just plain text. Basic > components try to give Flex-friendly names for HTMLElements. Some > component in Basic needs to inject a span into the DOM. In a few seconds > of looking at a Google web page, I did not see any divs with text as > children. I saw spans. The Divs all contained other elements. > > I don't create HTML web pages for a living, but if I were to place a label > over a control like I often see in Flex, I would not wrap the label in a > Div. The control would be div, so I would us a span or just plain text. > If I looked at the final DOM and saw Divs around every chunk of text, I > would think there is something heavy about the framework. > > Again, the goal is to encapsulate common patterns. Label combined with > some control is trying to replicate common patterns for labeling controls. > You are trying to solve the common pattern of truncating text. That will > require a Div. But truncation, or even width/height is not something that > should be built into Label for PAYG reasons. IMO, you should create a > different component with a different name. TruncatingLabel, or > LabelWIthTruncation. > > My 2 cents, > -Alex > > On 3/15/18, 12:19 PM, "Harbs" <[email protected]> wrote: > >> Why is span lighter than div? >> >> Inline and nowrap is not specific to span. AFAICT, there’s nothing >> specific to snap which fits Label better than div. >> >> As far as components which “does” span: Besides Span in HTML, we have >> HTMLText in Basic which encapsulates span. >> >> I can revert the change I made to Label, but I have not seen any downside >> to using div for Label. It seems to me that there’s nothing in the Label >> promise which dictates using span. >> >> Harbs >> >>> On Mar 15, 2018, at 6:55 PM, Alex Harui <[email protected]> >>> wrote: >>> >>> >>> >>> On 3/15/18, 5:34 AM, "Harbs" <[email protected]> wrote: >>> >>>> Gotcha. FWIW, we now have the HTML element component set which more >>>> thinly wraps HTML elements. >>>> >>>> I can’t think of any reason why Label would be better as a span than a >>>> div. It seems to me that simply using div instead of span would make >>>> Label more versatile. Am I missing something? >>> >>> You may be missing that the only real goal of Royale is to encapsulate >>> popular patterns. Pretty sure I've seen span used on many web pages, so >>> we need a component that does what it does, including assuming inline >>> instead of block display. Similarly, what would you think of a >>> framework >>> that had a HelloWorld that used a div instead of a span? You might >>> think >>> it is too heavy. >>> >>> Per PAYG, if span doesn’t' support certain features, then you create a >>> LabelWithTruncation and have it use a Div if you need to. >>> >>> My 2 cents, >>> -Alex >>>> >>>>> On Mar 15, 2018, at 2:30 PM, Peter Ent <[email protected]> wrote: >>>>> >>>>> Label was one of the very first components and the idea was >>>>> minimalism. >>>>> Button was <button> and TextInput was <input type="text"> and Label >>>>> was >>>>> <span>. >>>>> >>>>> I'm wondering if we should have NativeButton, NativeLabel, etc. which >>>>> would be these minimal elements and have others that are <div> >>>>> wrapping. >>>>> For instance, ImageAndTextButton is a <button><img src="goo.jpg">Label >>>>> Here</button> which works but the alignment is weird so maybe >>>>> ImageAndTextButton should be a <div><img>Text</div> which can be >>>>> aligned >>>>> and styled better. >>>>> >>>>> Anyway, that's the reason: simplicity. >>>>> >>>>> ‹peter >>>>> >>>>> On 3/15/18, 7:51 AM, "Harbs" <[email protected]> wrote: >>>>> >>>>>> Is there a reason that the element type of Basic Label is span? >>>>>> >>>>>> I tried adding a łTextOverflow˛ bead to a Label and it does not seem >>>>>> to >>>>>> work because spans donąt really have a working width. Switching the >>>>>> element type to div seems to make it work. >>>>>> >>>>>> Harbs >>>>> >>>> >>> >> >
