FAQ for column
and span
for descriptions
components
#4255
Unanswered
zhangpaopao0609
asked this question in
Q&A
Replies: 1 comment
-
👋 @zhangpaopao0609,感谢给 TDesign 提出了 issue。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here I will first pose the questions and case, and then give a full response for above.
Q1. Is there any relationship between
column
andspan
?CASE: In our document,
column
refers to the "count ofDescriptionItem
in one row". Therefore, can I assume that if I set thecolumn
to 3, it will consistently render 3DescriptionItems
in one row under any circumstances?However, based on my testing:
This is true when the items do not set a
span
property.However, when I set the
span
of the first item to 10, something goes wrong.It only renders the first item in the first row.
So, there must be some relationship between
column
and span, but our document doesn't mention anything about it.Q2. Does the
layout
affect thecolumn
orspan
?Q3. Does
item-layout
also affect thecolumn
orspan
?Q4. How can I evenly distribute multiple items in a row?
CASE:
ANSWER:
column
: This determines how many items will be rendered in each row, but it is affected bylayout
anditem-layout
.layout
is set tovertical
: Each row will render one item, and thecolumn
andspan
properties will be invalid.itemLayout
is set tovertical
: if column is set to 3, each row will render 3 items, and in HTML, 3td
elements will be renderedtd
elements will be rendered. This is because whenitem-layout
is set tohorizontal
, each item consists of 2td
elements (one for the label and one for the content).span
: In fact, it is an alias ofcolspan
, so it determines how manytd
elements this item will occupy in thistr
. However, it is also affected bylayout
anditem-layout
.layout
is set tovertical
: It behaves the same ascolumn
.item-layout
is set tovertical
:span
directly corresponds tocolspan
. If you setspan
to 3, then this item will occupy 3td
elements in HTML. (both label and content will be 3)span
to 3, then this item will occupy 6td
elements in HTML. (The label will be 1 and the content will be 5)The component will automatically calculate the total span amount for each row. If the span number exceeds the
td
number, it will automatically layout to the next row. For example, if bothlayout
anditem-layout
are set to their default values, and you setcolumn
to 3, and set the first itemspan
to 2, you will find that there are only two items in the first row. This is because thedescriptions
component will automatically calculate the span amount and adjust the layout accordingly.Unfortunately, we haven't added this feature yet, but we are currently working on it. It will be available soon.
[Descriptions] support evenly distribute multiple items in a row #4253
TODO
[ ]
descriptions
components document need more descriptions for column and span.Beta Was this translation helpful? Give feedback.
All reactions