<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.10.0.1</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>231</ContextCount>
  <ElementCount>348</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>false</FootnotesReported>
  <SegmentCount>72</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>10</UnitCount>
  <MyReports>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>101 - Document - Document and Entity Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DocumentandEntityInformation</Role>
      <ShortName>Document and Entity Information</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>103 - Statement - Consolidated Statements of Comprehensive Income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/StatementOfIncome</Role>
      <ShortName>Consolidated Statements of Comprehensive Income</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>104 - Statement - Consolidated Balance Sheets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/StatementOfFinancialPositionClassified</Role>
      <ShortName>Consolidated Balance Sheets</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>105 - Statement - Consolidated Balance Sheets (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/StatementOfFinancialPositionClassifiedParenthetical</Role>
      <ShortName>Consolidated Balance Sheets (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>106 - Statement - Statements of Changes in Stockholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/StatementOfShareholdersEquityAndOtherComprehensiveIncome</Role>
      <ShortName>Statements of Changes in Stockholders' Equity</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>107 - Statement - Consolidated Statements of Cash Flows</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/StatementOfCashFlowsIndirect</Role>
      <ShortName>Consolidated Statements of Cash Flows</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>108 - Disclosure - Business and Organization</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsNatureOfOperations</Role>
      <ShortName>Business and Organization</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>109 - Disclosure - Summary of Significant Accounting Policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBasisOfPresentationAndSignificantAccountingPoliciesTextBlock</Role>
      <ShortName>Summary of Significant Accounting Policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>110 - Disclosure - Acquisition</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBusinessCombinationDisclosureTextBlock</Role>
      <ShortName>Acquisition</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>111 - Disclosure - Inventories</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsInventoryDisclosureTextBlock</Role>
      <ShortName>Inventories</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>112 - Disclosure - Prepaid Expenses and Other Assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsPrepaidAndOtherCurrentAssetsDisclosureTextBlock</Role>
      <ShortName>Prepaid Expenses and Other Assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>113 - Disclosure - Goodwill and Other Intangible Assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsGoodwillAndIntangibleAssetsDisclosureTextBlock</Role>
      <ShortName>Goodwill and Other Intangible Assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>114 - Disclosure - Property, Plant and Equipment</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsPropertyPlantAndEquipmentDisclosureTextBlock</Role>
      <ShortName>Property, Plant and Equipment</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>115 - Disclosure - Accrued Expenses and Other Liabilities</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsAccountsPayableAccruedLiabilitiesAndOtherLiabilitiesDisclosureCurrentTextBlock</Role>
      <ShortName>Accrued Expenses and Other Liabilities</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>116 - Disclosure - Debt</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsDebtDisclosureTextBlock</Role>
      <ShortName>Debt</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>117 - Disclosure - Financial Instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsFinancialInstrumentsDisclosureTextBlock</Role>
      <ShortName>Financial Instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>118 - Disclosure - Stockholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsStockholdersEquityNoteDisclosureTextBlock</Role>
      <ShortName>Stockholders' Equity</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>119 - Disclosure - Revenue From Contract With Customer</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsRevenueFromContractWithCustomerTextBlock</Role>
      <ShortName>Revenue From Contract With Customer</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>120 - Disclosure - Stock-Based Compensation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsDisclosureOfCompensationRelatedCostsShareBasedPaymentsTextBlock</Role>
      <ShortName>Stock-Based Compensation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>121 - Disclosure - Leases</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsLeasesOfLesseeDisclosureTextBlock</Role>
      <ShortName>Leases</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>122 - Disclosure - Employee Benefit Plans</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsCompensationAndEmployeeBenefitPlansOtherThanShareBasedCompensationTextBlock</Role>
      <ShortName>Employee Benefit Plans</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>123 - Disclosure - Income Taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsIncomeTaxDisclosureTextBlock</Role>
      <ShortName>Income Taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>22</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>124 - Disclosure - Segment Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsSegmentReportingDisclosureTextBlock</Role>
      <ShortName>Segment Information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>23</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>125 - Disclosure - Seasonality</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsSeasonalityDisclosureTextBlock</Role>
      <ShortName>Seasonality</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>24</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>126 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsCommitmentsAndContingenciesDisclosureTextBlock</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>25</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>127 - Disclosure - Interim Financial Data (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsQuarterlyFinancialInformationTextBlock</Role>
      <ShortName>Interim Financial Data (Unaudited)</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>26</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>128 - Disclosure - Schedule II - Valuation and Qualifying Accounts and Reserves</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsScheduleOfValuationAndQualifyingAccountsDisclosureTextBlock</Role>
      <ShortName>Schedule II - Valuation and Qualifying Accounts and Reserves</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>27</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>129 - Disclosure - Summary of Significant Accounting Policies (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBasisOfPresentationAndSignificantAccountingPoliciesTextBlockPolicies</Role>
      <ShortName>Summary of Significant Accounting Policies (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBasisOfPresentationAndSignificantAccountingPoliciesTextBlock</ParentRole>
      <Position>28</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>130 - Disclosure - Summary of Significant Accounting Policies (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBasisOfPresentationAndSignificantAccountingPoliciesTextBlockTables</Role>
      <ShortName>Summary of Significant Accounting Policies (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBasisOfPresentationAndSignificantAccountingPoliciesTextBlock</ParentRole>
      <Position>29</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>131 - Disclosure - Acquisition (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBusinessCombinationDisclosureTextBlockTables</Role>
      <ShortName>Acquisition (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsBusinessCombinationDisclosureTextBlock</ParentRole>
      <Position>30</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>132 - Disclosure - Inventories (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsInventoryDisclosureTextBlockTables</Role>
      <ShortName>Inventories (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsInventoryDisclosureTextBlock</ParentRole>
      <Position>31</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>133 - Disclosure - Prepaid Expenses and Other Assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsPrepaidAndOtherCurrentAssetsDisclosureTextBlockTables</Role>
      <ShortName>Prepaid Expenses and Other Assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsPrepaidAndOtherCurrentAssetsDisclosureTextBlock</ParentRole>
      <Position>32</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>134 - Disclosure - Goodwill and Other Intangible Assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsGoodwillAndIntangibleAssetsDisclosureTextBlockTables</Role>
      <ShortName>Goodwill and Other Intangible Assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsGoodwillAndIntangibleAssetsDisclosureTextBlock</ParentRole>
      <Position>33</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>135 - Disclosure - Property, Plant and Equipment (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsPropertyPlantAndEquipmentDisclosureTextBlockTables</Role>
      <ShortName>Property, Plant and Equipment (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsPropertyPlantAndEquipmentDisclosureTextBlock</ParentRole>
      <Position>34</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>136 - Disclosure - Accrued Expenses and Other Liabilities (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsAccountsPayableAccruedLiabilitiesAndOtherLiabilitiesDisclosureCurrentTextBlockTables</Role>
      <ShortName>Accrued Expenses and Other Liabilities (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsAccountsPayableAccruedLiabilitiesAndOtherLiabilitiesDisclosureCurrentTextBlock</ParentRole>
      <Position>35</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>137 - Disclosure - Stockholders' Equity (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsStockholdersEquityNoteDisclosureTextBlockTables</Role>
      <ShortName>Stockholders' Equity (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsStockholdersEquityNoteDisclosureTextBlock</ParentRole>
      <Position>36</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>138 - Disclosure - Revenue From Contract With Customer (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsRevenueFromContractWithCustomerTextBlockTables</Role>
      <ShortName>Revenue From Contract With Customer (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsRevenueFromContractWithCustomerTextBlock</ParentRole>
      <Position>37</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>139 - Disclosure - Stock-Based Compensation (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsDisclosureOfCompensationRelatedCostsShareBasedPaymentsTextBlockTables</Role>
      <ShortName>Stock-Based Compensation (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsDisclosureOfCompensationRelatedCostsShareBasedPaymentsTextBlock</ParentRole>
      <Position>38</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>140 - Disclosure - Leases (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsLeasesOfLesseeDisclosureTextBlockTables</Role>
      <ShortName>Leases (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsLeasesOfLesseeDisclosureTextBlock</ParentRole>
      <Position>39</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>141 - Disclosure - Income Taxes (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsIncomeTaxDisclosureTextBlockTables</Role>
      <ShortName>Income Taxes (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsIncomeTaxDisclosureTextBlock</ParentRole>
      <Position>40</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>142 - Disclosure - Segment Information (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsSegmentReportingDisclosureTextBlockTables</Role>
      <ShortName>Segment Information (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsSegmentReportingDisclosureTextBlock</ParentRole>
      <Position>41</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>143 - Disclosure - Commitments and Contingencies (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsCommitmentsAndContingenciesDisclosureTextBlockTables</Role>
      <ShortName>Commitments and Contingencies (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsCommitmentsAndContingenciesDisclosureTextBlock</ParentRole>
      <Position>42</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>144 - Disclosure - Interim Financial Data (Unaudited) (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsQuarterlyFinancialInformationTextBlockTables</Role>
      <ShortName>Interim Financial Data (Unaudited) (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsQuarterlyFinancialInformationTextBlock</ParentRole>
      <Position>43</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>145 - Disclosure - Business and Organization - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureBusinessAndOrganizationAdditionalInformation</Role>
      <ShortName>Business and Organization - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>146 - Disclosure - Summary of Significant Accounting Policies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureSummaryOfSignificantAccountingPoliciesAdditionalInformation</Role>
      <ShortName>Summary of Significant Accounting Policies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>147 - Disclosure - Summary of Significant Accounting Policies - Estimated Useful Lives of Property Plant and Equipment (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureSummaryOfSignificantAccountingPoliciesEstimatedUsefulLivesOfPropertyPlantAndEquipment</Role>
      <ShortName>Summary of Significant Accounting Policies - Estimated Useful Lives of Property Plant and Equipment (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>46</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>148 - Disclosure - Acquisition - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureAcquisitionAdditionalInformation</Role>
      <ShortName>Acquisition - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>149 - Disclosure - Acquisition - Summary of Consideration Allocated to Assets Acquired and Liabilities Assumed (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureAcquisitionSummaryOfConsiderationAllocatedToAssetsAcquiredAndLiabilitiesAssumed</Role>
      <ShortName>Acquisition - Summary of Consideration Allocated to Assets Acquired and Liabilities Assumed (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>48</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>150 - Disclosure - Inventories - Summary of Inventories (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureInventoriesSummaryOfInventories</Role>
      <ShortName>Inventories - Summary of Inventories (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>49</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>151 - Disclosure - Inventories - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureInventoriesAdditionalInformation</Role>
      <ShortName>Inventories - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>152 - Disclosure - Prepaid Expenses and Other Assets - Summary of Prepaid Expenses and Other Assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosurePrepaidExpensesAndOtherAssetsSummaryOfPrepaidExpensesAndOtherAssets</Role>
      <ShortName>Prepaid Expenses and Other Assets - Summary of Prepaid Expenses and Other Assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>51</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>153 - Disclosure - Goodwill and Other Intangible Assets - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureGoodwillAndOtherIntangibleAssetsAdditionalInformation</Role>
      <ShortName>Goodwill and Other Intangible Assets - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>52</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>154 - Disclosure - Goodwill and Other Intangible Assets - Details of Intangible Assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureGoodwillAndOtherIntangibleAssetsDetailsOfIntangibleAssets</Role>
      <ShortName>Goodwill and Other Intangible Assets - Details of Intangible Assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>53</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>155 - Disclosure - Property, Plant and Equipment - Summary of Property, Plant and Equipment (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosurePropertyPlantAndEquipmentSummaryOfPropertyPlantAndEquipment</Role>
      <ShortName>Property, Plant and Equipment - Summary of Property, Plant and Equipment (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>54</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>156 - Disclosure - Property, Plant and Equipment - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosurePropertyPlantAndEquipmentAdditionalInformation</Role>
      <ShortName>Property, Plant and Equipment - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>55</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>157 - Disclosure - Accrued Expenses and Other Liabilities - Summary of Accrued Expenses and Other Liabilities (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureAccruedExpensesAndOtherLiabilitiesSummaryOfAccruedExpensesAndOtherLiabilities</Role>
      <ShortName>Accrued Expenses and Other Liabilities - Summary of Accrued Expenses and Other Liabilities (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>56</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>158 - Disclosure - Debt - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureDebtAdditionalInformation</Role>
      <ShortName>Debt - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>57</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R58.htm</HtmlFileName>
      <LongName>159 - Disclosure - Stockholders' Equity - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockholdersEquityAdditionalInformation</Role>
      <ShortName>Stockholders' Equity - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>58</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R59.htm</HtmlFileName>
      <LongName>160 - Disclosure - Stockholders' Equity - Computation of Basic and Diluted Earnings Per Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockholdersEquityComputationOfBasicAndDilutedEarningsPerShare</Role>
      <ShortName>Stockholders' Equity - Computation of Basic and Diluted Earnings Per Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>59</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R60.htm</HtmlFileName>
      <LongName>161 - Disclosure - Stockholders' Equity - Antidilutive Securities Excluded from Computation of Earnings Per Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockholdersEquityAntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShare</Role>
      <ShortName>Stockholders' Equity - Antidilutive Securities Excluded from Computation of Earnings Per Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>60</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R61.htm</HtmlFileName>
      <LongName>162 - Disclosure - Revenue From Contracts With Customers - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureRevenueFromContractsWithCustomersAdditionalInformation</Role>
      <ShortName>Revenue From Contracts With Customers - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>61</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R62.htm</HtmlFileName>
      <LongName>163 - Disclosure - Revenue From Contracts With Customers - Summary of Disaggregated Net Sales (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureRevenueFromContractsWithCustomersSummaryOfDisaggregatedNetSales</Role>
      <ShortName>Revenue From Contracts With Customers - Summary of Disaggregated Net Sales (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>62</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R63.htm</HtmlFileName>
      <LongName>164 - Disclosure - Stock-Based Compensation - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockBasedCompensationAdditionalInformation</Role>
      <ShortName>Stock-Based Compensation - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>63</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R64.htm</HtmlFileName>
      <LongName>165 - Disclosure - Stock-Based Compensation - Summary of Stock-Based Compensation Expenses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockBasedCompensationSummaryOfStockBasedCompensationExpenses</Role>
      <ShortName>Stock-Based Compensation - Summary of Stock-Based Compensation Expenses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>64</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R65.htm</HtmlFileName>
      <LongName>166 - Disclosure - Stock-Based Compensation - Time-Based Restricted Stock and Restricted Stock Unit Activity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockBasedCompensationTimeBasedRestrictedStockAndRestrictedStockUnitActivity</Role>
      <ShortName>Stock-Based Compensation - Time-Based Restricted Stock and Restricted Stock Unit Activity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>65</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R66.htm</HtmlFileName>
      <LongName>167 - Disclosure - Stock-Based Compensation - Performance-Based Restricted Stock Activity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockBasedCompensationPerformanceBasedRestrictedStockActivity</Role>
      <ShortName>Stock-Based Compensation - Performance-Based Restricted Stock Activity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>66</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R67.htm</HtmlFileName>
      <LongName>168 - Disclosure - Stock-Based Compensation - Summary of Assumptions Used to Estimate Fair Value of Each SAR (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockBasedCompensationSummaryOfAssumptionsUsedToEstimateFairValueOfEachSAR</Role>
      <ShortName>Stock-Based Compensation - Summary of Assumptions Used to Estimate Fair Value of Each SAR (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>67</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R68.htm</HtmlFileName>
      <LongName>169 - Disclosure - Stock-Based Compensation - SAR Activity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureStockBasedCompensationSARActivity</Role>
      <ShortName>Stock-Based Compensation - SAR Activity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>68</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R69.htm</HtmlFileName>
      <LongName>170 - Disclosure - Leases - Minimum Annual Payments Under Non-Cancelable Leases (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureLeasesMinimumAnnualPaymentsUnderNonCancelableLeases</Role>
      <ShortName>Leases - Minimum Annual Payments Under Non-Cancelable Leases (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>69</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R70.htm</HtmlFileName>
      <LongName>171 - Disclosure - Leases - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureLeasesAdditionalInformation</Role>
      <ShortName>Leases - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>70</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R71.htm</HtmlFileName>
      <LongName>172 - Disclosure - Employee Benefit Plans - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureEmployeeBenefitPlansAdditionalInformation</Role>
      <ShortName>Employee Benefit Plans - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>71</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R72.htm</HtmlFileName>
      <LongName>173 - Disclosure - Income Taxes - Income Tax Provision (Benefit) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureIncomeTaxesIncomeTaxProvisionBenefit</Role>
      <ShortName>Income Taxes - Income Tax Provision (Benefit) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>72</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R73.htm</HtmlFileName>
      <LongName>174 - Disclosure - Income Taxes - Reconciliation of Differences between Income Tax Provision and Income Tax Determined by Applying US Federal Statutory Rate (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureIncomeTaxesReconciliationOfDifferencesBetweenIncomeTaxProvisionAndIncomeTaxDeterminedByApplyingUSFederalStatutoryRate</Role>
      <ShortName>Income Taxes - Reconciliation of Differences between Income Tax Provision and Income Tax Determined by Applying US Federal Statutory Rate (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>73</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R74.htm</HtmlFileName>
      <LongName>175 - Disclosure - Income Taxes - Schedule of Deferred Tax Assets and Liabilities (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureIncomeTaxesScheduleOfDeferredTaxAssetsAndLiabilities</Role>
      <ShortName>Income Taxes - Schedule of Deferred Tax Assets and Liabilities (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>74</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R75.htm</HtmlFileName>
      <LongName>176 - Disclosure - Income Taxes - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureIncomeTaxesAdditionalInformation</Role>
      <ShortName>Income Taxes - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>75</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R76.htm</HtmlFileName>
      <LongName>177 - Disclosure - Segment Information - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureSegmentInformationAdditionalInformation</Role>
      <ShortName>Segment Information - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>76</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R77.htm</HtmlFileName>
      <LongName>178 - Disclosure - Segment Information - Details of Segment Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureSegmentInformationDetailsOfSegmentInformation</Role>
      <ShortName>Segment Information - Details of Segment Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>77</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R78.htm</HtmlFileName>
      <LongName>179 - Disclosure - Segment Information - Schedule of Reconciliation of Net Income to EBITDA (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureSegmentInformationScheduleOfReconciliationOfNetIncomeToEBITDA</Role>
      <ShortName>Segment Information - Schedule of Reconciliation of Net Income to EBITDA (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>78</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R79.htm</HtmlFileName>
      <LongName>180 - Disclosure - Commitments and Contingencies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureCommitmentsAndContingenciesAdditionalInformation</Role>
      <ShortName>Commitments and Contingencies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>79</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R80.htm</HtmlFileName>
      <LongName>181 - Disclosure - Commitments and Contingencies - Summary of Reconciliation of Company's Residential Product Warranty Reserve (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureCommitmentsAndContingenciesSummaryOfReconciliationOfCompanysResidentialProductWarrantyReserve</Role>
      <ShortName>Commitments and Contingencies - Summary of Reconciliation of Company's Residential Product Warranty Reserve (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>80</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R81.htm</HtmlFileName>
      <LongName>182 - Disclosure - Interim Financial Data (Unaudited) - Summary of Interim Financial Data (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureInterimFinancialDataUnauditedSummaryOfInterimFinancialData</Role>
      <ShortName>Interim Financial Data (Unaudited) - Summary of Interim Financial Data (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsQuarterlyFinancialInformationTextBlockTables</ParentRole>
      <Position>81</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R82.htm</HtmlFileName>
      <LongName>183 - Disclosure - Interim Financial Data (Unaudited) - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureInterimFinancialDataUnauditedAdditionalInformation</Role>
      <ShortName>Interim Financial Data (Unaudited) - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsQuarterlyFinancialInformationTextBlockTables</ParentRole>
      <Position>82</Position>
    </Report>
    <Report instance="trex-20181231.xml">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R83.htm</HtmlFileName>
      <LongName>184 - Disclosure - Schedule II - Valuation and Qualifying Accounts and Reserves (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.trex.com/taxonomy/role/DisclosureScheduleIIValuationAndQualifyingAccountsAndReserves</Role>
      <ShortName>Schedule II - Valuation and Qualifying Accounts and Reserves (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.trex.com/taxonomy/role/NotesToFinancialStatementsScheduleOfValuationAndQualifyingAccountsDisclosureTextBlock</ParentRole>
      <Position>83</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File>trex-20181231.xml</File>
    <File>trex-20181231.xsd</File>
    <File>trex-20181231_cal.xml</File>
    <File>trex-20181231_def.xml</File>
    <File>trex-20181231_lab.xml</File>
    <File>trex-20181231_pre.xml</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy>http://fasb.org/srt/2018-01-31</BaseTaxonomy>
    <BaseTaxonomy>http://xbrl.sec.gov/dei/2018-01-31</BaseTaxonomy>
    <BaseTaxonomy>http://fasb.org/us-gaap/2018-01-31</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
